-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (54 loc) · 1.82 KB
/
Copy pathrelease.yml
File metadata and controls
66 lines (54 loc) · 1.82 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
on:
push:
branches:
- master
name: Release
jobs:
publish:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js v24
uses: actions/setup-node@v4
with:
node-version: 24
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
diff-search: true
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Push to release branch
if: steps.check.outputs.changed == 'true'
run: |
awk '!/^dist$/' .gitignore > tmp && mv tmp .gitignore
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "release"
- name: Creating version tag
if: steps.check.outputs.changed == 'true'
run: |
VERSION=${{ steps.check.outputs.version }}
MAJOR=$(echo $VERSION | cut -d. -f1)
git tag -fa v${VERSION} -m v${VERSION}
git tag -fa v${MAJOR} -m v${VERSION}
- name: Push changes
if: steps.check.outputs.changed == 'true'
run: git push origin HEAD:release --force --tags
- name: Create Release
if: steps.check.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create v${{ steps.check.outputs.version }} --title "Release v${{ steps.check.outputs.version }}" --notes ""
- name: Delete release branch
if: always() && steps.check.outputs.changed == 'true'
run: git push origin --delete release || true