|
| 1 | +name: Deploy Release |
| 2 | + |
1 | 3 | on: |
2 | 4 | release: |
3 | 5 | types: [published] |
4 | 6 |
|
5 | | -name: Deploy Extension |
6 | 7 | jobs: |
7 | | - deploy: |
| 8 | + prepare: |
| 9 | + name: Prepare Release |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + VERSION: ${{ steps.version.outputs.VERSION }} |
| 13 | + PRE_RELEASE: ${{ steps.pre.outputs.PRE_RELEASE }} |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v6 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + - uses: actions/setup-node@v6 |
| 19 | + with: |
| 20 | + node-version: 22.x |
| 21 | + |
| 22 | + - name: Capture prerelease flag |
| 23 | + id: pre |
| 24 | + run: echo "PRE_RELEASE=${{ github.event.release.prerelease }}" >> $GITHUB_OUTPUT |
| 25 | + |
| 26 | + - name: Derive version from tag |
| 27 | + id: version |
| 28 | + run: | |
| 29 | + ref="${GITHUB_REF_NAME}" |
| 30 | + version="${ref#v}" |
| 31 | + echo "VERSION=$version" >> $GITHUB_OUTPUT |
| 32 | +
|
| 33 | + deploy-vscode: |
| 34 | + name: Publish Release (VS Code Marketplace) |
| 35 | + needs: prepare |
8 | 36 | runs-on: ubuntu-latest |
| 37 | + environment: publish-vscode |
| 38 | + concurrency: publish-vscode |
| 39 | + env: |
| 40 | + VERSION: ${{ needs.prepare.outputs.VERSION }} |
| 41 | + PRE_RELEASE: ${{ needs.prepare.outputs.PRE_RELEASE }} |
9 | 42 | steps: |
10 | 43 | - uses: actions/checkout@v6 |
11 | 44 | - uses: actions/setup-node@v6 |
12 | 45 | with: |
13 | 46 | node-version: 22.x |
14 | 47 | - run: npm ci |
15 | 48 |
|
16 | | - # Package and publish the extension to VS Code Marketplace |
17 | | - # Do not produce a git tag, only increment the version in package.json |
18 | | - - name: Publish Release ${{ github.ref_name }} |
19 | | - if: startsWith(github.ref, 'refs/tags/v') |
| 49 | + - name: Package and publish to VS Code Marketplace |
20 | 50 | run: | |
21 | 51 | npm i -g @vscode/vsce |
22 | | - if [ "$pre_release" = true ] ; then |
23 | | - vsce publish --no-git-tag-version --pre-release ${GITHUB_REF_NAME:1} |
| 52 | + if [ "${PRE_RELEASE}" = "true" ]; then |
| 53 | + vsce publish --no-git-tag-version --pre-release "${VERSION}" |
24 | 54 | else |
25 | | - vsce publish --no-git-tag-version ${GITHUB_REF_NAME:1} |
| 55 | + vsce publish --no-git-tag-version "${VERSION}" |
26 | 56 | fi |
27 | 57 | env: |
28 | | - pre_release: ${{ github.event.release.prerelease }} |
29 | 58 | VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }} |
30 | 59 |
|
31 | | - # Commit the new version to the repository default branch and update the tag |
32 | | - # This removes the signing of the commit, tag and release since it's |
33 | | - # created by the GitHub Actions bot |
34 | | - # - name: Update package.json version |
35 | | - # if: startsWith(github.ref, 'refs/tags/v') |
36 | | - # run: | |
37 | | - # git config user.name github-actions |
38 | | - # git config user.email 41898282+github-actions[bot]@users.noreply.github.com |
39 | | - # git switch -c tmp |
40 | | - # git add package.json |
41 | | - # git commit -m "ci: update version to ${GITHUB_REF_NAME:1}" |
42 | | - # git fetch |
43 | | - # git switch main |
44 | | - # git merge tmp |
45 | | - # git tag -f $GITHUB_REF_NAME |
46 | | - # git push origin -f $GITHUB_REF_NAME |
47 | | - # git push origin -f main |
48 | | - |
49 | | - # Upload the artifact as a release asset |
50 | | - - uses: softprops/action-gh-release@master |
| 60 | + - name: Upload VSIX to release assets |
| 61 | + uses: softprops/action-gh-release@master |
51 | 62 | if: startsWith(github.ref, 'refs/tags/v') |
52 | 63 | with: |
53 | 64 | files: ./*.vsix |
| 65 | + |
| 66 | + deploy-openvsx: |
| 67 | + name: Publish Release (OpenVSX) |
| 68 | + needs: prepare |
| 69 | + runs-on: ubuntu-latest |
| 70 | + environment: publish-openvsx |
| 71 | + concurrency: publish-openvsx |
| 72 | + env: |
| 73 | + VERSION: ${{ needs.prepare.outputs.VERSION }} |
| 74 | + PRE_RELEASE: ${{ needs.prepare.outputs.PRE_RELEASE }} |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v6 |
| 77 | + - uses: actions/setup-node@v6 |
| 78 | + with: |
| 79 | + node-version: 22.x |
| 80 | + - run: npm ci |
| 81 | + |
| 82 | + - name: Apply OpenVSX patch |
| 83 | + run: node ./scripts/patch-openvsx.mjs |
| 84 | + |
| 85 | + - name: Publish to OpenVSX |
| 86 | + run: | |
| 87 | + npm i -g @vscode/vsce ovsx |
| 88 | + if [ "${PRE_RELEASE}" = "true" ]; then |
| 89 | + vsce package --no-git-tag-version --pre-release "${VERSION}" |
| 90 | + else |
| 91 | + vsce package --no-git-tag-version "${VERSION}" |
| 92 | + fi |
| 93 | + ovsx publish ./*.vsix --skip-duplicate |
| 94 | + env: |
| 95 | + OVSX_PAT: ${{ secrets.OPENVSX_MARKETPLACE_TOKEN }} |
0 commit comments