|
| 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: Checkout vscode-knative |
| 27 | + uses: actions/checkout@v4 |
| 28 | + - name: Use Node.js |
| 29 | + uses: actions/setup-node@v4 |
| 30 | + with: |
| 31 | + node-version: 20 |
| 32 | + - name: Install dependencies |
| 33 | + run: | |
| 34 | + npm install -g typescript "@vscode/vsce" "ovsx" |
| 35 | + npm install |
| 36 | + echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV |
| 37 | + - name: Build And Run Unit Tests |
| 38 | + uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1 |
| 39 | + with: |
| 40 | + run: npm run test |
| 41 | + - name: Run UI Tests |
| 42 | + continue-on-error: true |
| 43 | + uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1 |
| 44 | + with: |
| 45 | + run: npm run base-ui-test |
| 46 | + - name: Package |
| 47 | + run: | |
| 48 | + jq --tab '.extensionDependencies += [ "ms-kubernetes-tools.vscode-kubernetes-tools" ]' package.json > package.json.new |
| 49 | + mv package.json.new package.json |
| 50 | + node ./out/build/update-readme.js |
| 51 | + vsce package -o vscode-knative-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix |
| 52 | + sha256sum *.vsix > vscode-knative-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix.sha256 |
| 53 | + ls -lash *.vsix *.sha256 |
| 54 | + - name: Upload VSIX Artifacts |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: vscode-knative |
| 58 | + path: vscode-knative-${{ env.EXT_VERSION }}-${{github.run_number}}.vsix |
| 59 | + if-no-files-found: error |
| 60 | + - name: Publish to GH Release Tab |
| 61 | + if: ${{ inputs.publishToMarketPlace == 'true' && inputs.publishToOVSX == 'true' }} |
| 62 | + uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0" |
| 63 | + with: |
| 64 | + repo_token: "${{ secrets.GITHUB_TOKEN }}" |
| 65 | + automatic_release_tag: "${{ env.EXT_VERSION }}" |
| 66 | + draft: true |
| 67 | + files: | |
| 68 | + vscode-knative-${{ env.EXT_VERSION }}-${{github.run_number}}.vsix |
| 69 | + vscode-knative-${{ env.EXT_VERSION }}-${{github.run_number}}.vsix.sha256 |
| 70 | +
|
| 71 | + release-job: |
| 72 | + if: ${{ inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true' }} |
| 73 | + environment: ${{ 'release' }} |
| 74 | + runs-on: ubuntu-latest |
| 75 | + needs: packaging-job |
| 76 | + steps: |
| 77 | + - name: Checkout vscode-knative |
| 78 | + uses: actions/checkout@v4 |
| 79 | + - name: Use Node.js |
| 80 | + uses: actions/setup-node@v4 |
| 81 | + with: |
| 82 | + node-version: 20 |
| 83 | + - name: Install dependencies |
| 84 | + run: | |
| 85 | + npm install -g typescript "@vscode/vsce" "ovsx" |
| 86 | + npm install |
| 87 | + echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV |
| 88 | + - name: Download VSIX Artifacts |
| 89 | + uses: actions/download-artifact@v4 |
| 90 | + - name: Publish to VS Code Marketplace |
| 91 | + if: ${{ inputs.publishToMarketPlace == 'true' }} |
| 92 | + run: | |
| 93 | + vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-knative/vscode-knative-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix |
| 94 | + - name: Publish to OpenVSX Registry |
| 95 | + if: ${{ inputs.publishToOVSX == 'true' }} |
| 96 | + run: | |
| 97 | + ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-knative/vscode-knative-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix |
0 commit comments