Manual Publish - patch #30
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: Manual Publish | |
| run-name: Manual Publish - ${{ github.event.inputs.releaseType }}${{ github.event.inputs.dryRun == 'yes' && ' (DRY RUN)' || '' }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| releaseType: | |
| description: 'Release Type' | |
| required: true | |
| type: choice | |
| default: 'patch' | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| - prepatch | |
| - preminor | |
| - premajor | |
| - prerelease | |
| publishMarketplace: | |
| description: 'Publish on Visual Studio Marketplace?' | |
| required: true | |
| type: choice | |
| default: 'yes' | |
| options: | |
| - 'yes' | |
| - 'no' | |
| force-bump: | |
| description: 'Skip the lerna changed check? (If "yes", `lerna version` will be executed with `--force-publish`)' | |
| required: true | |
| type: choice | |
| default: 'no' | |
| options: | |
| - 'yes' | |
| - 'no' | |
| dryRun: | |
| description: 'Dry run? If yes, this workflow will NOT push to remote and NOT publish the extension.' | |
| required: true | |
| type: choice | |
| default: 'yes' | |
| options: | |
| - 'yes' | |
| - 'no' | |
| env: | |
| TURBO_TELEMETRY_DISABLED: 1 | |
| jobs: | |
| release: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π· Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| ref: 'main' | |
| fetch-depth: 0 | |
| - name: π οΈ Setup workspace | |
| uses: ./.github/actions/setup-workspace | |
| with: | |
| node-version: '20' | |
| - name: πͺ Generate Prerelease patch version number | |
| id: gen-pre-release-ver | |
| env: | |
| RELEASE_TYPE: ${{ github.event.inputs.releaseType }} | |
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
| with: | |
| result-encoding: string | |
| script: | | |
| const releaseType = process.env.RELEASE_TYPE; | |
| const isPreRelease = releaseType.startsWith('pre') | |
| const version = isPreRelease ? String(Math.floor(Date.now() / 1000)) : ''; | |
| if (isPreRelease) { | |
| core.info(`Pre-release patch version number: ${version}`) | |
| } else { | |
| core.info(`This is not pre-release: ${version}`) | |
| } | |
| return version | |
| - name: π§ Bump the version | |
| id: bump | |
| run: > | |
| pnpm lerna version | |
| ${{ github.event.inputs.releaseType }} | |
| ${{ github.event.inputs.force-bump == 'yes' && '--force-publish' || '' }} | |
| --no-push --exact --preid next --yes -m "chore(release): %s" | |
| env: | |
| GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} | |
| VSCODE_WDIO_PRE_RELEASE_PATCH_NUMBER: ${{ steps.gen-pre-release-ver.outputs.result }} | |
| - name: π« Build and publish as pre-release | |
| if: ${{ github.event.inputs.publishMarketplace == 'yes' && startsWith(github.event.inputs.releaseType, 'pre') }} | |
| run: | | |
| pnpm run publish:next | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} | |
| VSCODE_WDIO_DRY_RUN: ${{ github.event.inputs.dryRun }} | |
| VSCODE_WDIO_PRE_RELEASE_PATCH_NUMBER: ${{ steps.gen-pre-release-ver.outputs.result }} | |
| - name: π Build and publish | |
| if: ${{ github.event.inputs.publishMarketplace == 'yes' && !startsWith(github.event.inputs.releaseType, 'pre') }} | |
| run: | | |
| pnpm run publish | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} | |
| VSCODE_WDIO_DRY_RUN: ${{ github.event.inputs.dryRun }} | |
| - name: β Push to remote repository | |
| env: | |
| IS_DRY_RUN: ${{ github.event.inputs.dryRun }} | |
| run: | | |
| if [ "${IS_DRY_RUN}" = "yes" ]; then | |
| git push origin --no-verify --follow-tags --dry-run | |
| else | |
| git push origin --no-verify --follow-tags | |
| fi | |
| - name: π Create the Github Release | |
| run: | | |
| pnpm --filter @vscode-wdio/release run release-note | |
| env: | |
| GITHUB_AUTH: ${{ secrets.WDIO_BOT_GITHUB_TOKEN }} | |
| VSCODE_WDIO_DRY_RUN: ${{ github.event.inputs.dryRun }} | |
| VSCODE_WDIO_RELEASE_NOTE: ${{ steps.bump.outputs.changelog }} |