File tree Expand file tree Collapse file tree 2 files changed +51
-3
lines changed
Expand file tree Collapse file tree 2 files changed +51
-3
lines changed Original file line number Diff line number Diff line change 77 paths :
88 - package.json
99
10+ workflow_dispatch :
11+ inputs :
12+ version :
13+ description : " Version to release"
14+ required : true
1015jobs :
16+ check-version-change :
17+ outputs :
18+ changed : ${{ steps.check-version.outputs.result }}
19+
20+ runs-on : ubuntu-latest
21+
22+ permissions :
23+ contents : read
24+
25+ steps :
26+ - uses : actions/checkout@v3
27+ - name : Check if version has changed
28+ id : check-version
29+ uses : actions/github-script@v6
30+ with :
31+ script : |
32+ const version = '${{ github.event.inputs.version }}' || require('./package.json').version;
33+ // Find a release for that version
34+ const release = await github.rest.repos.getReleaseByTag({
35+ owner: context.repo.owner,
36+ repo: context.repo.repo,
37+ tag: `release-v${version}`,
38+ }).catch(() => null);
39+
40+ // If the release exists, the version has not changed
41+ if (release) {
42+ console.log(`Version ${version} has an existing release`);
43+ console.log(release.data.html_url);
44+ core.summary.addLink(`Release v${version}`, release.data.html_url);
45+ await core.summary.write();
46+ return "false";
47+ }
48+ console.log(`Version ${version} does not have a release`);
49+ return true;
50+
1151 release :
52+ needs : check-version-change
53+ if : ${{ needs.check-version-change.outputs.changed == 'true' }}
54+
1255 runs-on : ubuntu-latest
1356
1457 permissions :
68111 }
69112 });
70113
114+ core.summary.addLink(`Release v${version}`, release.data.html_url);
115+ await core.summary.write();
116+
71117 publish :
72118 environment : publish
73119
Original file line number Diff line number Diff line change 1- name : Release and publish extension
1+ name : Create release PR
22
3- run-name : Release new version
3+ run-name : Create release PR for v${{ github.event.inputs. version }}
44
55on :
66 workflow_dispatch :
3737 git add package.json package-lock.json
3838 git commit -m "Release extension version ${{ inputs.version }}"
3939
40- git push
40+ git push --set-upstream origin release/${{ inputs.version }}
4141
4242 - name : Create PR
4343 run : |
4646 --body "Release version ${{ inputs.version }}" \
4747 --base main \
4848 --head release/${{ inputs.version }}
49+ env :
50+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments