-
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.27 KB
/
publish.yml
File metadata and controls
51 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- 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 --force