|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + publishToMarketPlace: |
| 7 | + description: "Publish to VS Code Marketplace ?" |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - "true" |
| 12 | + - "false" |
| 13 | + default: "false" |
| 14 | + publishToOVSX: |
| 15 | + description: "Publish to OpenVSX Registry ?" |
| 16 | + required: true |
| 17 | + type: choice |
| 18 | + options: |
| 19 | + - "true" |
| 20 | + - "false" |
| 21 | + default: "false" |
| 22 | +jobs: |
| 23 | + packaging-job: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Check Out vscode-devfile |
| 27 | + uses: actions/checkout@v2 |
| 28 | + - name: Set Up NodeJS |
| 29 | + uses: actions/setup-node@v2 |
| 30 | + with: |
| 31 | + node-version: "18" |
| 32 | + - name: Install NodeJS dependencies |
| 33 | + run: npm install -g typescript "@vscode/vsce" "ovsx" |
| 34 | + - name: Build vscode-devfile |
| 35 | + run: | |
| 36 | + npm install |
| 37 | + npm run vscode:prepublish |
| 38 | + npm run compile |
| 39 | + echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV |
| 40 | + - name: Package vscode-devfile |
| 41 | + run: | |
| 42 | + vsce package -o vscode-devfile-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix |
| 43 | + ls -lash *.vsix |
| 44 | + - name: Upload VSIX Artifacts |
| 45 | + uses: actions/upload-artifact@v2 |
| 46 | + with: |
| 47 | + name: vscode-devfile |
| 48 | + path: | |
| 49 | + vscode-devfile-${{ env.EXT_VERSION }}-${{ github.run_number }}.vsix |
| 50 | + if-no-files-found: error |
| 51 | + - name: Publish to GH Release Tab |
| 52 | + if: ${{ inputs.publishToMarketPlace == 'true' && inputs.publishToOVSX == 'true' }} |
| 53 | + uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0" |
| 54 | + with: |
| 55 | + repo_token: "${{ secrets.GITHUB_TOKEN }}" |
| 56 | + automatic_release_tag: "v${{ env.EXT_VERSION }}" |
| 57 | + title: "${{ env.EXT_VERSION }}" |
| 58 | + draft: true |
| 59 | + files: | |
| 60 | + vscode-devfile-${{ env.EXT_VERSION }}-${{ github.run_number }}.vsix |
| 61 | + release-job: |
| 62 | + environment: ${{ (inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true') && 'release' || 'pre-release' }} |
| 63 | + runs-on: ubuntu-latest |
| 64 | + needs: packaging-job |
| 65 | + steps: |
| 66 | + - name: Set Up NodeJS |
| 67 | + uses: actions/setup-node@v2 |
| 68 | + with: |
| 69 | + node-version: "18" |
| 70 | + - name: Install dependencies |
| 71 | + run: | |
| 72 | + npm install -g typescript "@vscode/vsce" "ovsx" |
| 73 | + - name: Download VSIX |
| 74 | + uses: actions/download-artifact@v3 |
| 75 | + - name: Publish to VS Code Marketplace |
| 76 | + if: ${{ inputs.publishToMarketPlace == 'true' }} |
| 77 | + run: | |
| 78 | + vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-walkthrough-extension/vscode-devfile-*-${GITHUB_RUN_NUMBER}.vsix |
| 79 | + - name: Publish to OpenVSX Registry |
| 80 | + if: ${{ inputs.publishToOVSX == 'true' == 'true' }} |
| 81 | + run: | |
| 82 | + ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-walkthrough-extension/vscode-devfile-*-${GITHUB_RUN_NUMBER}.vsix |
0 commit comments