|
| 1 | +name: 🚀 Release packages |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + branch: |
| 7 | + description: 'Branch to release' |
| 8 | + required: true |
| 9 | + default: 'main' |
| 10 | + npm_tag: |
| 11 | + type: choice |
| 12 | + description: 'Specify npm tag' |
| 13 | + required: true |
| 14 | + default: 'alpha' |
| 15 | + options: |
| 16 | + - alpha |
| 17 | + - beta |
| 18 | + - rc |
| 19 | + - canary |
| 20 | + - latest |
| 21 | + extension_type: |
| 22 | + type: choice |
| 23 | + description: 'Specify the release type of extension' |
| 24 | + required: true |
| 25 | + default: pre-release |
| 26 | + options: |
| 27 | + - official |
| 28 | + - pre-release |
| 29 | + |
| 30 | + to_release: |
| 31 | + description: 'Packages to release' |
| 32 | + type: choice |
| 33 | + required: true |
| 34 | + options: |
| 35 | + - all |
| 36 | + - npm |
| 37 | + - extension |
| 38 | + |
| 39 | +env: |
| 40 | + GO_VERSION: '1.24.1' |
| 41 | + |
| 42 | +jobs: |
| 43 | + publish: |
| 44 | + name: Build |
| 45 | + env: |
| 46 | + release_npm: ${{ inputs.to_release == 'all' || inputs.to_release == 'npm' }} |
| 47 | + release_extension: ${{ inputs.to_release == 'all' || inputs.to_release == 'extension' }} |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - name: Checkout |
| 51 | + uses: actions/checkout@v4 |
| 52 | + with: |
| 53 | + fetch-depth: 1 |
| 54 | + ref: ${{ github.event.inputs.branch }} |
| 55 | + |
| 56 | + - name: Setup Node.js |
| 57 | + uses: actions/setup-node@v4 |
| 58 | + with: |
| 59 | + node-version: '24' |
| 60 | + |
| 61 | + - name: Setup Go |
| 62 | + uses: actions/setup-go@v5 |
| 63 | + with: |
| 64 | + go-version: ${{ env.GO_VERSION }} |
| 65 | + |
| 66 | + - name: Install pnpm |
| 67 | + run: corepack enable |
| 68 | + |
| 69 | + - name: Install dependencies |
| 70 | + run: pnpm install --frozen-lockfile |
| 71 | + |
| 72 | + - name: Format code |
| 73 | + run: pnpm format:check |
| 74 | + |
| 75 | + - name: TypeCheck |
| 76 | + run: pnpm typecheck |
| 77 | + |
| 78 | + - name: Lint code |
| 79 | + run: pnpm lint |
| 80 | + |
| 81 | + - name: Build packages |
| 82 | + run: pnpm build |
| 83 | + |
| 84 | + - name: Test on Linux |
| 85 | + if: runner.os == 'Linux' |
| 86 | + run: xvfb-run -a pnpm -r test |
| 87 | + |
| 88 | + - name: Publish npm packages |
| 89 | + if: env.release_npm == 'true' |
| 90 | + env: |
| 91 | + NPM_TOKEN: ${{ secrets.RSLINT_NPM_TOKEN }} |
| 92 | + run: | |
| 93 | + npm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}" |
| 94 | + pnpm -r publish --tag ${{ github.event.inputs.npm_tag }} --publish-branch ${{ github.event.inputs.branch }} |
| 95 | +
|
| 96 | + - name: Build and publish to Microsoft VS Code Marketplace |
| 97 | + if: env.release_extension == 'true' |
| 98 | + env: |
| 99 | + VSCE_PAT: ${{ secrets.RSLINT_VSCE_PAT }} |
| 100 | + run: | |
| 101 | + if [ "${{ github.event.inputs.extension_type }}" = "pre-release" ]; then |
| 102 | + pnpm publish:vsce --prerelease |
| 103 | + else |
| 104 | + pnpm publish:vsce |
| 105 | + fi |
| 106 | +
|
| 107 | + - name: Build and publish to Open VSX Registry |
| 108 | + if: env.release_extension == 'true' |
| 109 | + env: |
| 110 | + OVSX_PAT: ${{ secrets.RSLINT_OVSX_PAT }} |
| 111 | + run: | |
| 112 | + if [ "${{ github.event.inputs.extension_type }}" = "pre-release" ]; then |
| 113 | + pnpm publish:ovsx --prerelease |
| 114 | + else |
| 115 | + pnpm publish:ovsx |
| 116 | + fi |
0 commit comments