-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (100 loc) · 2.67 KB
/
Copy pathnode.js.yml
File metadata and controls
120 lines (100 loc) · 2.67 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# CI runs on every push and PR.
# Merges to main: bump version + release, then build with new version + deploy.
name: CI & Deploy
on:
push:
branches: [ "**" ]
paths-ignore:
- 'CHANGELOG.md'
pull_request:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
release:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: ci
runs-on: ubuntu-latest
concurrency:
group: "release"
cancel-in-progress: false
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: 'npm'
- run: npm ci
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Run release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push changes
run: git push --follow-tags origin main
- name: Extract version
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Release ${{ steps.version.outputs.tag }}
generate_release_notes: true
draft: false
prerelease: false
deploy:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: release
runs-on: ubuntu-latest
concurrency:
group: "pages-deploy"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
with:
ref: main # pull the latest main (with bumped version)
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: dist/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5