Skip to content

Publish

Publish #36

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
versionClass:
type: choice
required: true
options:
- 'patch'
- 'minor'
- 'major'
schedule:
- cron: '0 0 20 * *' # at AM 9 JST on day of month 20
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: '.node-version'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Bump version and publish
id: bump-version
run: |
git config user.name '[bot] github action (${{ github.workflow }})'
git config user.email 'engineer-team@knowledgework.com'
pnpm version ${{ github.event_name == 'schedule' && 'patch' || github.event.inputs.versionClass }}
pnpm release
echo "new_version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.repos.createRelease({
owner: "${{github.repository_owner}}",
repo: "${{github.repository}}".split('/')[1],
tag_name: "v${{ steps.bump-version.outputs.new_version }}",
generate_release_notes: true,
})