Skip to content

Publish

Publish #16

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
versionClass:
type: choice
required: true
options:
- 'patch'
- 'minor'
- 'major'
schedule:
- cron: '0 0 15 * *' # at AM 9 JST on day of month 15
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version: '18'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn install --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'
yarn version --${{ github.event_name == 'schedule' && 'patch' || github.event.inputs.versionClass }}
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,
})