Repository navigation
56 lines (53 loc) · 1.94 KB
/
Copy pathdeploy.yml
File metadata and controls
56 lines (53 loc) · 1.94 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
name: Deploy
on:
pull_request:
types: [closed]
branches: [main]
workflow_dispatch:
concurrency:
group: deploy-${{ github.event.pull_request.base.ref || github.ref_name }}
cancel-in-progress: false
jobs:
deploy:
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
cache: npm
- run: npm install
- name: Get version info
id: version
run: |
CURRENT=$(node -p "require('./package.json').version")
echo "current=$CURRENT" >> $GITHUB_OUTPUT
if echo "$CURRENT" | grep -q '\-rc\.'; then
STABLE=$(echo "$CURRENT" | sed 's/-rc\.[0-9]*//')
echo "stable=$STABLE" >> $GITHUB_OUTPUT
echo "is_rc=true" >> $GITHUB_OUTPUT
else
echo "is_rc=false" >> $GITHUB_OUTPUT
fi
- name: Bump to stable version
if: steps.version.outputs.is_rc == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -- package-lock.json
npm version ${{ steps.version.outputs.stable }}
git push --follow-tags
- name: Build
if: github.event_name == 'workflow_dispatch' || steps.version.outputs.is_rc == 'true'
run: npm run build
- name: Deploy to GitHub Pages
if: github.event_name == 'workflow_dispatch' || steps.version.outputs.is_rc == 'true'
uses: JamesIves/github-pages-deploy-action@fa24774553152dd7873cd16ebd8d959b010c5445 # v4.9.0
with:
folder: dist
clean-exclude: pr-preview