v1.2.3 #25
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 semantic tags | |
on: | |
release: | |
types: | |
- published | |
permissions: | |
contents: write | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Release with semantic tag like v1.0.3 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- run: npm install semver | |
- name: Get versions | |
uses: actions/github-script@v7 | |
id: batch | |
env: | |
TAG_NAME: ${{ github.event.release.tag_name }} | |
with: | |
script: | | |
const semver = require('semver') | |
const { TAG_NAME } = process.env | |
return { | |
minor: `v${semver.major(TAG_NAME).toString()}.${semver.minor(TAG_NAME).toString()}`, | |
major: `v${semver.major(TAG_NAME).toString()}` | |
} | |
- run: | | |
git tag -f "$MAJOR_VER" | |
git tag -f "$MINOR_VER" | |
git push origin -f "$MAJOR_VER" | |
git push origin -f "$MINOR_VER" | |
env: | |
MAJOR_VER: ${{ fromJSON(steps.batch.outputs.result).major }} | |
MINOR_VER: ${{ fromJSON(steps.batch.outputs.result).minor }} |