Skip to content

Commit d0694b3

Browse files
committed
Update the release workflow
Only do a version bump if this is run as part of the release process.
1 parent 804c708 commit d0694b3

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ jobs:
2020
build:
2121
name: Release
2222
runs-on: ubuntu-latest
23-
env:
24-
APP_INSIGHTS_KEY: '${{ secrets.APP_INSIGHTS_KEY }}'
2523
steps:
2624
- name: Checkout
2725
uses: actions/checkout@v2
@@ -37,7 +35,10 @@ jobs:
3735
shell: bash
3836

3937
- name: Build
38+
env:
39+
APP_INSIGHTS_KEY: '${{ secrets.APP_INSIGHTS_KEY }}'
4040
run: |
41+
echo "APP INSIGHTS KEY LENGTH: ${#APP_INSIGHTS_KEY}"
4142
cd extensions/ql-vscode
4243
npm run build -- --release
4344
shell: bash
@@ -58,7 +59,6 @@ jobs:
5859
5960
# Uploading artifacts is not necessary to create a release.
6061
# This is just in case the release itself fails and we want to access the built artifacts from Actions.
61-
# TODO Remove if not useful.
6262
- name: Upload artifacts
6363
uses: actions/upload-artifact@v2
6464
with:
@@ -69,6 +69,7 @@ jobs:
6969

7070
- name: Create release
7171
id: create-release
72+
if: github.event_name == 'pull_request'
7273
uses: actions/create-release@v1.0.0
7374
env:
7475
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -83,7 +84,7 @@ jobs:
8384

8485
- name: Upload release asset
8586
uses: actions/upload-release-asset@v1.0.1
86-
if: success()
87+
if: success() && github.event_name == 'pull_request'
8788
env:
8889
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8990
with:
@@ -94,16 +95,27 @@ jobs:
9495
asset_name: ${{ format('vscode-codeql-{0}.vsix', steps.prepare-artifacts.outputs.ref_name) }}
9596
asset_content_type: application/zip
9697

98+
99+
- name: No Release
100+
if: github.event_name != 'pull_request'
101+
run: |
102+
echo "Not making a release because this is not a pull request"
103+
104+
###
105+
# Do Post release work: version bump and changelog PR
106+
# Only do this if we are running from a PR (ie- this is part of the release process)
107+
97108
# The checkout action does not fetch the main branch.
98109
# Fetch the main branch so that we can base the version bump PR against main.
99110
- name: Fetch main branch
111+
if: github.event_name == 'pull_request'
100112
run: |
101113
git fetch --depth=1 origin main:main
102114
git checkout main
103115
104116
- name: Bump patch version
105117
id: bump-patch-version
106-
if: success()
118+
if: success() && github.event_name == 'pull_request'
107119
run: |
108120
cd extensions/ql-vscode
109121
# Bump to the next patch version. Major or minor version bumps will have to be done manually.
@@ -112,14 +124,14 @@ jobs:
112124
echo "::set-output name=next_version::$NEXT_VERSION"
113125
114126
- name: Add changelog for next release
115-
if: success()
127+
if: success() && github.event_name == 'pull_request'
116128
run: |
117129
cd extensions/ql-vscode
118130
perl -i -pe 's/^/## \[UNRELEASED\]\n\n/ if($.==3)' CHANGELOG.md
119131
120132
- name: Create version bump PR
121133
uses: peter-evans/create-pull-request@c7f493a8000b8aeb17a1332e326ba76b57cb83eb # v3.4.1
122-
if: success()
134+
if: success() && github.event_name == 'pull_request'
123135
with:
124136
token: ${{ secrets.GITHUB_TOKEN }}
125137
commit-message: Bump version to ${{ steps.bump-patch-version.outputs.next_version }}

0 commit comments

Comments
 (0)