Manual Pre-Release Publish #97
This file contains 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 Pre-Release Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch. Defaults to "main".' | |
required: true | |
default: 'main' | |
npmTag: | |
description: 'NPM tag. Defaults to "next".' | |
required: true | |
default: 'next' | |
preReleaseName: | |
description: 'Pre-release name. This is used in the version string, e.g. "beta" for `7.0.0-beta.0`. Defaults to "next".' | |
required: true | |
default: 'next' | |
preReleaseVersion: | |
description: 'The new pre-release version to create. Choose "existing" to increment the latest pre-release.' | |
required: true | |
type: choice | |
options: | |
- existing | |
- patch | |
- minor | |
- major | |
dryRun: | |
description: 'Do not touch or write anything. Show the commands.' | |
required: true | |
default: false | |
type: boolean | |
env: | |
DRY_RUN_ARG: ${{ inputs.dryRun && '--dry-run' || '' }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
HUSKY: '0' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{inputs.branch}} | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- uses: pnpm/action-setup@v4 | |
with: | |
run_install: false | |
- name: Package Manager Setup | |
run: | | |
pnpm set registry "https://registry.npmjs.org/" | |
pnpm set //registry.npmjs.org/:_authToken $NPM_TOKEN | |
pnpm whoami | |
- name: Git Setup | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "WebdriverIO Release Bot" | |
- name: SSH Agent | |
uses: cardoe/ssh-agent-deploy-key@v1 | |
with: | |
ssh-private-key: | | |
${{ secrets.DEPLOY_KEY }} | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Publish Pre-Release | |
run: | | |
pnpm run build | |
if [ "${{inputs.preReleaseVersion}}" == "existing" ]; then | |
pnpx tsx scripts/release.ts $DRY_RUN_ARG --preRelease=${{inputs.preReleaseName}} --npm.tag=${{inputs.npmTag}} --no-git.requireupstream | |
else | |
pnpx tsx scripts/release.ts ${{inputs.preReleaseVersion}} $DRY_RUN_ARG --preRelease=${{inputs.preReleaseName}} --npm.tag=${{inputs.npmTag}} --no-git.requireupstream | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |