0.0.179 #148
Workflow file for this run
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: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Release tag' | |
required: true | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Set tag from input | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "GITHUB_TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_ENV" | |
- name: Set tag from REF | |
if: github.event_name == 'release' | |
run: | | |
echo "GITHUB_TAG=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV" | |
- name: Checkout repository on release | |
if: github.event_name == 'release' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.target_commitish }} | |
token: ${{secrets.PAT_TOKEN}} | |
fetch-depth: 0 | |
- name: Checkout repository on workflow_dispatch | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/checkout@v4 | |
- name: Set up Git | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
- name: Bump package version | |
run: | | |
npm pkg set version=$GITHUB_TAG | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm ci | |
- run: npm run test | |
- run: npm run build | |
- run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_CI_TOKEN }} | |
- name: update package version | |
run: | | |
npm i --package-lock-only | |
git add package.json package-lock.json | |
git commit -m 'bump version to ${{ env.GITHUB_TAG }}' | |
git push | |
- name: Set tag from input | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
git tag $GITHUB_TAG | |
git push origin $GITHUB_TAG | |