Skip to content

release

release #39

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
package:
required: true
type: choice
options:
- utils
- utils-react
- utils-experimental
default: utils
jobs:
release:
runs-on: ubuntu-22.04
environment:
name: npm-release
url: ${{ steps.release_log.outputs.RELEASE_URL }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 18
# create .npmrc with NODE_AUTH_TOKEN https://github.com/actions/setup-node/blob/3dbcda8bc2eb5ec6aa3fbde01feaae3236952db8/src/authutil.ts#L48
registry-url: "https://registry.npmjs.org"
cache: pnpm
- run: pnpm i --frozen-lockfile
- run: pnpm build
- run: pnpm -C packages/${{ inputs.package }} release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
- id: release_log
run: |
package_name="@hiogawa/${{ inputs.package }}"
package_version=$(jq -r .version packages/${{ inputs.package }}/package.json)
echo "RELEASE_URL=https://www.npmjs.com/package/${package_name}/v/${package_version}" >> "$GITHUB_OUTPUT"