-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (57 loc) · 2.06 KB
/
create-github-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: create-github-release
on:
pull_request:
branches:
- main
types:
# There's no event type for "merged", so we just run any time a PR is closed, and exit early
# if the PR wasn't actually merged.
- closed
jobs:
verify-should-run:
# Since the workflow runs any time a PR against main is closed, we need this
# `if` to make sure that the workflow only does anything meaningful if the PR
# was actually merged.
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- run: echo 'PR was merged, so running is fine'
# We need a VSIX to attach to the release.
create-vsix-artifact:
name: 'Upload VSIX as artifact'
needs: verify-should-run
uses: ./.github/workflows/create-vsix-artifact.yml
create-github-release:
runs-on: ubuntu-latest
needs: create-vsix-artifact
permissions:
contents: write
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
- name: Get version property
id: get-version-property
run: |
PACKAGE_VERSION=$(jq -r ".version" package.json)
echo "package_version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT"
- name: Download VSIX artifact
id: download
uses: actions/download-artifact@v4
with:
name: vsix
# Download the VSIX to a subdirectory of HOME, so it's guaranteed to be somewhere we can see.
path: ~/downloads
# Create the release
- name: Create github release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get-version-property.outputs.package_version }}
name: v${{ steps.get-version-property.outputs.package_version }}
body: See [release notes](https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/release-notes.html)
target_commitish: main
token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
make_latest: true
# Attach the unzipped VSIX using a glob
files: ~/downloads/*.vsix