Publish #55
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: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
type: choice | |
required: true | |
options: | |
- patch | |
- minor | |
- major | |
permissions: | |
contents: write | |
id-token: write | |
actions: write | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
registry-url: 'https://registry.npmjs.org' | |
- uses: pnpm/action-setup@v3.0.0 | |
with: | |
version: ^9.9.0 | |
run_install: false | |
- name: Install dependencies | |
run: pnpm install | |
- name: Bump version | |
run: | | |
git config user.name 'vue-metamorph release bot' | |
git config user.email 'unrefinedbrain@users.noreply.github.com' | |
npm version ${{ inputs.release_type }} | |
git push --follow-tags origin master | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} | |
run: | | |
VERSION=v$(cat package.json | jq --raw-output .version) | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/UnrefinedBrain/vue-metamorph/releases \ | |
-f tag_name="$VERSION" \ | |
-F draft=false \ | |
-F prerelease=false \ | |
-F generate_release_notes=true | |
- name: Build | |
run: pnpm build | |
- name: Publish | |
run: npm publish --access=public --provenance | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |