Manual Prerelease Publish #3
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 Prerelease Publish | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: | |
inputs: | |
prereleaseVersion: | |
description: 'The new prerelease version to create.' | |
required: true | |
default: 'prerelease' | |
type: choice | |
options: | |
- prepatch | |
- preminor | |
- premajor | |
- prerelease | |
prereleaseIdentifier: | |
description: 'Prerelease Identifier. Used for NPM tag and version string. Defaults to "next", e.g. "1.0.0-next.0".' | |
required: true | |
default: 'next' | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
HUSKY: '0' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
ref: 'main' | |
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 "github-actions[bot]@users.noreply.github.com'" | |
git config --global user.name "Zutron Release Bot" | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm build | |
- name: Update Turbo Version config | |
uses: restackio/[email protected] | |
with: | |
file: version.config.json | |
fields: '{"prereleaseIdentifier": "${{inputs.prereleaseIdentifier}}"}' | |
- name: Create Release and Tags | |
shell: bash | |
run: pnpm turbo-version -b ${{inputs.prereleaseVersion}} | |
- name: Publish to NPM | |
shell: bash | |
run: pnpm publish -r --tag ${{inputs.prereleaseIdentifier}} | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Push Tags and Commits | |
id: push-tags | |
shell: bash | |
run: | | |
git push --tags && git push | |
echo "RELEASE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
generate_release_notes: true | |
prerelease: true | |
repository: goosewobbler/zutron | |
tag_name: ${{ steps.push-tags.outputs.RELEASE_TAG }} | |
token: ${{ secrets.GITHUB_TOKEN }} |