Skip to content

Tag CI

Tag CI #5

Workflow file for this run

name: Tag CI
env:
context: './'
cache-name: cache-release
node-version: 20.x
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
on:
push:
tags:
- 'v**'
jobs:
next-version:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Compute tag version
id: get-version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$(echo ${VERSION} | sed s/^v//)" >> $GITHUB_OUTPUT
release-npm-package:
name: Release package on npm
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v4
- name: Extract tag name
id: extract_tag
shell: bash
run: echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: yarn
- name: Install
run: yarn install --immutable
- name: Build
run: yarn build
- name: Publish
run: yarn npm publish