11name : Release and publish extension
22
3- run-name : Release v${{ github.event.inputs. version }}
3+ run-name : Release new version
44
55on :
66 workflow_dispatch :
1010 description : " Version to bump `package.json` to (format: x.y.z)"
1111
1212jobs :
13- release :
13+ create-release-pr :
14+ name : Create release PR
15+
1416 runs-on : ubuntu-latest
1517
1618 permissions :
@@ -28,65 +30,18 @@ jobs:
2830 git config --global user.email "github-actions@github.com"
2931 git config --global user.name "GitHub Actions"
3032
31- npm version ${{ github.event.inputs.version }} --no-git-tag-version
33+ git checkout -b release/${{ inputs.version }}
34+
35+ npm version ${{ inputs.version }} --no-git-tag-version
3236 git add package.json package-lock.json
33- git commit -m "Release extension version ${{ github.event. inputs.version }}"
37+ git commit -m "Release extension version ${{ inputs.version }}"
3438
3539 git push
3640
37- - run : npm ci
38- - run : npm run package
39-
40- - uses : actions/upload-artifact@v3
41- with :
42- name : vscode-github-actions-${{ github.event.inputs.version }}.vsix
43- path : ./vscode-github-actions-${{ github.event.inputs.version }}.vsix
44-
45- - name : Create release and upload release asset
46- uses : actions/github-script@v6
47- with :
48- script : |
49- const fs = require("fs");
50-
51- const release = await github.rest.repos.createRelease({
52- owner: context.repo.owner,
53- repo: context.repo.repo,
54- tag_name: "release-v${{ github.event.inputs.version }}",
55- name: "v${{ github.event.inputs.version }}",
56- draft: false,
57- prerelease: false
58- });
59-
60- const path = "./vscode-github-actions-${{ github.event.inputs.version }}.vsix";
61- await github.rest.repos.uploadReleaseAsset({
62- owner: context.repo.owner,
63- repo: context.repo.repo,
64- release_id: release.data.id,
65- data: fs.readFileSync(path).toString(),
66- name: "vscode-github-actions-${{ github.event.inputs.version }}.vsix",
67- headers: {
68- "content-type": "application/vsix",
69- "content-length": fs.statSync(path).size
70- }
71- });
72-
73- publish :
74- environment : publish
75-
76- needs : release
77-
78- runs-on : ubuntu-latest
79- permissions : {}
80-
81- steps :
82- - uses : actions/download-artifact@v3
83- with :
84- name : vscode-github-actions-${{ github.event.inputs.version }}.vsix
85-
86- - name : Publish to marketplace
87- # https://github.com/HaaLeo/publish-vscode-extension/releases/tag/v1.2.0
88- uses : HaaLeo/publish-vscode-extension@c1a0486c5a3eed24e8c21d4e37889a7c4c60c443
89- with :
90- pat : ${{ secrets.PUBLISHER_KEY }}
91- registryUrl : https://marketplace.visualstudio.com
92- extensionFile : ./vscode-github-actions-${{ github.event.inputs.version }}.vsix
41+ - name : Create PR
42+ run : |
43+ gh pr create \
44+ --title "Release version ${{ inputs.version }}" \
45+ --body "Release version ${{ inputs.version }}" \
46+ --base main \
47+ --head release/${{ inputs.version }}
0 commit comments