-
Notifications
You must be signed in to change notification settings - Fork 9
49 lines (43 loc) · 1.19 KB
/
tag.yml
File metadata and controls
49 lines (43 loc) · 1.19 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
name: Tag
on:
push:
branches:
- main
workflow_dispatch:
jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Install plugins
run: npm install @semantic-release/git @semantic-release/exec
- name: Run semantic-release
id: release
run: |
before=$(git tag -l | sort -V | tail -1)
npx semantic-release
after=$(git tag -l | sort -V | tail -1)
if [ "$before" != "$after" ]; then
echo "released=true" >> "$GITHUB_OUTPUT"
echo "new_tag=$after" >> "$GITHUB_OUTPUT"
else
echo "released=false" >> "$GITHUB_OUTPUT"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger release workflow
if: steps.release.outputs.released == 'true'
run: |
gh workflow run release.yml --ref main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}