Add immutableCreate option to build-publish workflow #777
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
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| pre-release: | |
| description: 'Create a pre-release' | |
| required: true | |
| default: true | |
| type: boolean | |
| jobs: | |
| deploy: | |
| # Allow one concurrent deployment | |
| concurrency: | |
| group: ${{ github.event_name == 'push' && 'pages' || github.run_id }} | |
| cancel-in-progress: true | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: ${{ github.event_name == 'push' && 'github-pages' || '' }} | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| env: | |
| BASE_URL: https://${{ github.repository_owner }}.github.io${{ github.repository_owner != github.event.repository.name && format('/{0}', github.event.repository.name) || '' }} | |
| REPO_NAME: ${{ github.repository_owner != github.event.repository.name && format('{0}-{1}', github.repository_owner, github.event.repository.name) || github.repository_owner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Setup YamlDotnetFork | |
| run: | | |
| git clone https://github.com/ChristopherHX/runner-server-lsp-YamlDotNet YamlDotNet | |
| echo "YAML_DOTNET_FORK_PATH=$PWD/YamlDotNet/YamlDotNet/YamlDotNet.csproj" >> $GITHUB_ENV | |
| - name: Build ExpandAzurePipelines | |
| run: dotnet publish src/ExpandAzurePipelines -c Release --output out | |
| - name: Build azure-pipelines-vscode-ext | |
| if: | | |
| !cancelled() | |
| run: | | |
| npm install | |
| dotnet new globaljson --sdk-version 8.0.0 --roll-forward latestMinor --force | |
| dotnet workload install wasm-tools | |
| npm run build | |
| node_modules/.bin/vsce pack -o azure-pipelines-vscode-ext.vsix | |
| # Generate unique version using existing major.minor | |
| NEW_VERSION=$(node -p " | |
| require('./package.json').version.replace(/\.\d+$/, '.${{ github.run_number }}') | |
| ") | |
| # Update package.json version | |
| npm version $NEW_VERSION --no-git-tag-version | |
| # Create vsix for artifact | |
| node_modules/.bin/vsce pack --pre-release -o azure-pipelines-vscode-ext-pre-release.vsix | |
| working-directory: src/azure-pipelines-vscode-ext | |
| - name: Run azure-pipelines-vscode-ext Tests | |
| run: ${{ runner.os == 'Linux' && 'xvfb-run -a ' || ''}}npm test | |
| working-directory: src/azure-pipelines-vscode-ext | |
| - name: Publish Pre-Release VS Marketplace | |
| env: | |
| HAS_VSCE_TOKEN: ${{ secrets.VSCE_TOKEN && '1' || '' }} | |
| if: | | |
| !contains(github.event_name, 'pull') && env.HAS_VSCE_TOKEN | |
| run: | | |
| echo "Publishing Pre-Release" | |
| node_modules/.bin/vsce publish --skip-duplicate -p ${{ secrets.VSCE_TOKEN }} -i azure-pipelines-vscode-ext${{ (github.event_name != 'workflow_dispatch' || inputs.pre-release) && '-pre-release' || '' }}.vsix | |
| working-directory: src/azure-pipelines-vscode-ext | |
| - name: Publish Pre-Release Open VSX | |
| env: | |
| HAS_OVSX_TOKEN: ${{ secrets.OVSX_TOKEN && '1' || '' }} | |
| if: | | |
| !contains(github.event_name, 'pull') && env.HAS_OVSX_TOKEN | |
| run: | | |
| echo "Publishing Pre-Release" | |
| npx --yes ovsx publish --skip-duplicate azure-pipelines-vscode-ext${{ (github.event_name != 'workflow_dispatch' || inputs.pre-release) && '-pre-release' || '' }}.vsix -p ${{ secrets.OVSX_TOKEN }} | |
| working-directory: src/azure-pipelines-vscode-ext | |
| - name: Build runner-server-vscode | |
| if: | | |
| !cancelled() | |
| run: | | |
| npm install | |
| npm run build | |
| node_modules/.bin/vsce pack -o runner-server-vscode.vsix | |
| node_modules/.bin/vsce pack --pre-release -o runner-server-vscode-pre-release.vsix | |
| working-directory: src/runner-server-vscode | |
| - name: Build runner-server-web-vscode | |
| if: | | |
| !cancelled() | |
| run: | | |
| npm install | |
| dotnet new globaljson --sdk-version 8.0.0 --roll-forward latestMinor --force | |
| dotnet workload install wasm-tools | |
| npm run build | |
| node_modules/.bin/vsce pack -o runner-server-web-vscode.vsix | |
| node_modules/.bin/vsce pack --pre-release -o runner-server-web-vscode-pre-release.vsix | |
| working-directory: src/runner-server-web-vscode | |
| - name: Make layout | |
| if: | | |
| !cancelled() | |
| run: | | |
| mkdir webapp | |
| mv out/wwwroot webapp/ExpandAzurePipelines | |
| mkdir -p webapp/azure-pipelines-vscode-ext | |
| mv src/azure-pipelines-vscode-ext/build webapp/azure-pipelines-vscode-ext/ | |
| mv src/azure-pipelines-vscode-ext/dist webapp/azure-pipelines-vscode-ext/ | |
| mv src/azure-pipelines-vscode-ext/package.json webapp/azure-pipelines-vscode-ext/ | |
| mv src/azure-pipelines-vscode-ext/*.vsix webapp/azure-pipelines-vscode-ext/ | |
| mkdir -p webapp/runner-server-vscode | |
| mv src/runner-server-vscode/*.vsix webapp/runner-server-vscode/ | |
| mkdir -p webapp/runner-server-web-vscode | |
| mv src/runner-server-web-vscode/*.vsix webapp/runner-server-web-vscode/ | |
| - name: Upload vsix | |
| uses: actions/upload-artifact@v4 | |
| if: | | |
| !cancelled() | |
| with: | |
| name: azure-pipelines-vscode-ext-pre-release | |
| path: webapp/azure-pipelines-vscode-ext/azure-pipelines-vscode-ext-pre-release.vsix | |
| - name: Upload vsix runner-server | |
| uses: actions/upload-artifact@v4 | |
| if: | | |
| !cancelled() | |
| with: | |
| name: runner-server-vscode-pre-release | |
| path: webapp/runner-server-vscode/runner-server-vscode-pre-release.vsix | |
| - name: Upload vsix runner-server-web | |
| uses: actions/upload-artifact@v4 | |
| if: | | |
| !cancelled() | |
| with: | |
| name: runner-server-web-vscode-pre-release | |
| path: webapp/runner-server-web-vscode/runner-server-web-vscode-pre-release.vsix | |
| - name: Setup Pages | |
| if: github.event_name == 'push' | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| if: github.event_name == 'push' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'webapp' | |
| - name: Deploy to GitHub Pages | |
| if: github.event_name == 'push' | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |