Attempted release fix v2 #144
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: [push, pull_request, workflow_dispatch] | |
| jobs: | |
| validate: | |
| name: Validate Version | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'pull_request' }} | |
| outputs: | |
| version: ${{ steps.get-version.outputs.version }} | |
| released: ${{ steps.is-released.outputs.released == 'true' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| - id: get-version | |
| run: bun repl -e "console.log('version=' + require('./package.json').version)" >> "$GITHUB_OUTPUT" | |
| - id: is-released | |
| run: | | |
| if gh release view v${{ steps.get-version.outputs.VERSION }} &> /dev/null ; then | |
| echo "released=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "released=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: bun install | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - run: bunx vsce package | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| path: "*.vsix" | |
| if-no-files-found: error | |
| archive: false | |
| release: | |
| needs: [build, validate] | |
| runs-on: ubuntu-latest | |
| if: success() && needs.validate.outputs.released == 'false' | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| - uses: oven-sh/setup-bun@v2 | |
| - uses: ncipollo/release-action@v1 | |
| with: | |
| name: ${{ needs.validate.outputs.version }} | |
| tag: v${{ needs.validate.outputs.version }} | |
| commit: ${{ github.head_ref || github.ref_name }} | |
| artifacts: "*.vsix" | |
| prerelease: ${{ contains(needs.validate.outputs.version, '-') }} | |
| generateReleaseNotes: true | |
| immutableCreate: true | |
| publish: | |
| needs: [build, validate, release] | |
| runs-on: ubuntu-latest | |
| if: success() && !contains(needs.validate.outputs.version, '-') | |
| strategy: | |
| matrix: | |
| registry: ["vsce", "ovsx"] | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| - uses: oven-sh/setup-bun@v2 | |
| - if: ${{ matrix.registry == 'vsce' }} | |
| run: bunx vsce publish --packagePath $(find . -iname *.vsix) | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| - if: ${{ matrix.registry == 'ovsx' }} | |
| run: bunx ovsx publish --packagePath $(find . -iname *.vsix) | |
| env: | |
| OVSX_PAT: ${{ secrets.OVSX_PAT }} |