5. Build extension + upload - Prisma CLI version 7.3.0-dev.9 #14
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: 5. Build extension # and upload as release to GitHub | |
| run-name: 5. Build extension + upload - ${{ inputs.trigger_reason }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_channel: | |
| description: "Identifies whether we're publishing an insider or stable release of the extension" | |
| required: true | |
| type: choice | |
| options: | |
| - insider | |
| - stable | |
| extension_version: | |
| description: 'VS Code extension version' | |
| required: true | |
| branch: | |
| description: 'Branch to run run this workflow on' | |
| required: true | |
| trigger_reason: | |
| description: 'Information about what caused the publishing process in the first place.' | |
| required: true | |
| env: | |
| ENVIRONMENT: ${{ secrets.ENVIRONMENT }} | |
| PRISMA_TELEMETRY_INFORMATION: 'language-tools 5_build.yml' | |
| jobs: | |
| build: | |
| name: Build extension | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 7 | |
| outputs: | |
| tag_name: ${{ steps.names.outputs.tag_name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.branch }} | |
| token: ${{ secrets.PRISMA_BOT_TOKEN }} | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Print inputs | |
| run: | | |
| echo ${{github.event.inputs.release_channel}} | |
| echo ${{github.event.inputs.extension_version}} | |
| echo ${{github.event.inputs.branch}} | |
| echo ${{github.event.inputs.trigger_reason}} | |
| # Build the extension | |
| - name: Install Dependencies | |
| run: pnpm install | |
| - name: Typecheck all packages | |
| run: pnpm typecheck | |
| - name: Build all packages | |
| run: pnpm build | |
| - name: Replace Readme for marketplace | |
| run: node scripts/change_readme.mjs ${{ github.event.inputs.release_channel }} | |
| - name: Build vsix | |
| run: cd packages/vscode && pnpm package | |
| # Create GitHub Release and upload built result as asset | |
| - name: Get git tag and asset name | |
| id: names | |
| run: node scripts/get_tag_name.mjs ${{ github.event.inputs.release_channel }} ${{ github.event.inputs.extension_version }} | |
| - name: create a GitHub release | |
| id: create_release | |
| # This action is not maintained since 3+ years! | |
| # see https://github.com/actions/create-release/issues/119 | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.names.outputs.tag_name }} | |
| release_name: ${{ steps.names.outputs.tag_name }} | |
| - name: Get asset name for release asset | |
| id: get_asset_name | |
| run: | | |
| echo "asset_name=${{ steps.names.outputs.asset_name }}-${{ github.event.inputs.extension_version }}.vsix" >> "$GITHUB_OUTPUT" | |
| - name: Upload Release Asset | |
| id: upload-release-asset | |
| # This action is not maintained since 3+ years! | |
| # see https://github.com/actions/upload-release-asset/issues/78 | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{github.workspace}}/packages/vscode/${{ steps.get_asset_name.outputs.asset_name }} | |
| asset_name: ${{ steps.get_asset_name.outputs.asset_name }} | |
| asset_content_type: application/zip | |
| - name: Trigger next workflow to publish extension | |
| uses: benc-uk/workflow-dispatch@v1 | |
| with: | |
| workflow: 6. Publish | |
| token: ${{ secrets.PRISMA_BOT_TOKEN }} | |
| inputs: '{ "asset_name": "${{ steps.get_asset_name.outputs.asset_name }}", "tag_name": "${{ steps.names.outputs.tag_name }}", "trigger_reason": "${{github.event.inputs.trigger_reason}}" }' |