|
| 1 | +on: |
| 2 | + release: |
| 3 | + types: [prereleased, released] |
| 4 | + |
| 5 | +name: Deploy Extension |
| 6 | +jobs: |
| 7 | + build-vsix: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v2 |
| 11 | + - uses: actions/setup-node@v1 |
| 12 | + with: |
| 13 | + node-version: 17 |
| 14 | + - run: yarn install --immutable --immutable-cache --check-cache |
| 15 | + - name: Package Extension |
| 16 | + id: packageExtension |
| 17 | + uses: HaaLeo/publish-vscode-extension@v1 |
| 18 | + with: |
| 19 | + pat: stub |
| 20 | + dryRun: true |
| 21 | + yarn: true |
| 22 | + |
| 23 | + - name: Upload extension vsix to workflow artifacts |
| 24 | + uses: actions/upload-artifact@v3 |
| 25 | + with: |
| 26 | + name: haskell-${{ github.event.release.tag_name }}.vsix |
| 27 | + path: ${{ steps.packageExtension.outputs.vsixPath }} |
| 28 | + outputs: |
| 29 | + vsixPath: ${{ steps.packageExtension.outputs.vsixPath }} |
| 30 | + |
| 31 | + ## If this is a release job, publish to VSCode, |
| 32 | + ## otherwise publish a pre-release to VSCode |
| 33 | + deploy-vs: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + needs: [build-vsix] |
| 36 | + steps: |
| 37 | + - name: Publish to Visual Studio Marketplace |
| 38 | + id: publishToVSMarketplace |
| 39 | + uses: HaaLeo/publish-vscode-extension@v1 |
| 40 | + with: |
| 41 | + pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} |
| 42 | + registryUrl: https://marketplace.visualstudio.com |
| 43 | + extensionFile: ${{ needs.build-vsix.outputs.vsixPath }} |
| 44 | + yarn: true |
| 45 | + preRelease: ${{ github.event.action == 'prereleased' }} |
| 46 | + |
| 47 | + ## Publish to VSX iff this is a release |
| 48 | + deploy-vsx: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + needs: [build-vsix] |
| 51 | + # Run this job only on release, VSX doesn't support pre-releases yet |
| 52 | + if: ${{ github.event.action == 'released' }} |
| 53 | + steps: |
| 54 | + - name: Publish to Open VSX Registry |
| 55 | + id: publishToOpenVSX |
| 56 | + continue-on-error: true |
| 57 | + uses: HaaLeo/publish-vscode-extension@v1 |
| 58 | + with: |
| 59 | + pat: ${{ secrets.OPEN_VSX_TOKEN }} |
| 60 | + extensionFile: ${{ needs.build-vsix.outputs.vsixPath }} |
| 61 | + yarn: true |
0 commit comments