Repository navigation
90 lines (72 loc) · 2.58 KB
/
Copy pathversion.yml
File metadata and controls
90 lines (72 loc) · 2.58 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Create release from version commit
on:
push:
branches:
- dev
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check commit trigger
id: trigger
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
FIRST_LINE="$(echo "$COMMIT_MESSAGE" | head -n1)"
if [[ "$FIRST_LINE" =~ ^[Vv]ersion([[:space:]]|$) ]]; then
echo "release=true" >> "$GITHUB_OUTPUT"
else
echo "Not a new version."
echo "release=false" >> "$GITHUB_OUTPUT"
fi
- name: Read version from package.json
if: steps.trigger.outputs.release == 'true'
id: version
run: |
VERSION="$(node -p "require('./package.json').version")"
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid version in package.json: $VERSION"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 26
cache: npm
- name: Install dependencies
run: npm ci
- name: Run ESLint
if: steps.trigger.outputs.release == 'true'
run: npm run lint
- name: Build project
if: steps.trigger.outputs.release == 'true'
run: npm run build
- name: Create static export archive
if: steps.trigger.outputs.release == 'true'
run: |
if [ ! -d "out" ]; then
echo "Static export directory 'out' not found."
exit 1
fi
zip -r "opengenogram-v${{ steps.version.outputs.version }}.zip" out
- name: Create Git tag
if: steps.trigger.outputs.release == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
- name: Create GitHub Release
if: steps.trigger.outputs.release == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ steps.version.outputs.version }}"
name: "v${{ steps.version.outputs.version }}"
generate_release_notes: true
files: |
opengenogram-v${{ steps.version.outputs.version }}.zip