Release Extension & CLI #6
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: Release Extension & CLI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish_openvsx: | |
| description: 'Publish Extension to Open VSX' | |
| type: boolean | |
| required: true | |
| default: true | |
| publish_marketplace: | |
| description: 'Publish Extension to Marketplace' | |
| type: boolean | |
| required: true | |
| default: true | |
| publish_npm: | |
| description: 'Publish CLI to NPM' | |
| type: boolean | |
| required: true | |
| default: true | |
| jobs: | |
| release: | |
| name: Release and Publish | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install Extension Dependencies | |
| run: | | |
| npm install | |
| npm install -g vsce ovsx | |
| - name: Install CLI Dependencies | |
| working-directory: cli | |
| run: | | |
| npm install | |
| - name: Build Extension | |
| run: vsce package | |
| - name: Build CLI | |
| working-directory: cli | |
| run: | | |
| npm run webpack | |
| npm publish --dry-run | |
| - name: Publish to Open VSX | |
| if: github.event_name == 'release' || inputs.publish_openvsx == true | |
| run: npx ovsx publish -p $OPENVSX_TOKEN | |
| env: | |
| OPENVSX_TOKEN: ${{ secrets.OPENVSX_TOKEN }} | |
| - name: Publish to Marketplace | |
| if: github.event_name == 'release' || inputs.publish_marketplace == true | |
| run: vsce publish -p $PUBLISHER_TOKEN | |
| env: | |
| PUBLISHER_TOKEN: ${{ secrets.PUBLISHER_TOKEN }} | |
| - name: Publish CLI to NPM | |
| if: github.event_name == 'release' || inputs.publish_npm == true | |
| working-directory: cli | |
| run: | | |
| npm run webpack | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |