Workflow file for this run
This file contains hidden or 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 GitHub Action | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Matches version tags like v1.0.0 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests | |
run: npm test | |
- name: Build action | |
run: npm run build | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
- name: Update major version tag | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
MAJOR_VERSION=$(echo ${{ github.ref_name }} | sed -E 's/^v([0-9]+)\..*/v\1/') | |
git tag -fa $MAJOR_VERSION -m "Update $MAJOR_VERSION tag to ${{ github.ref_name }}" | |
git push origin $MAJOR_VERSION |