-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (103 loc) · 3.73 KB
/
Copy pathdeploy.yml
File metadata and controls
123 lines (103 loc) · 3.73 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
121
122
123
name: Deploy to GitHub Pages
on:
push:
tags:
- "v[0-9]*"
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_GA_MEASUREMENT_ID: ${{ vars.NEXT_PUBLIC_GA_MEASUREMENT_ID || secrets.NEXT_PUBLIC_GA_MEASUREMENT_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
- name: Sync package.json version
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit version bump
run: |
git add package.json package-lock.json
git diff --staged --quiet || git commit -m ":bookmark: Bump version to ${{ steps.version.outputs.version }}"
git push origin HEAD:root
- name: Build
run: npm run build
- name: Run Lychee pre-deploy gate
id: lychee
continue-on-error: true
uses: lycheeverse/lychee-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fail: true
format: markdown
output: lychee/predeploy-out.md
jobSummary: true
args: >
--config .lychee.toml
--verbose
--exclude '^https://mindoff\.work/.*'
--root-dir "${{ github.workspace }}/out"
out
- name: Prepare release broken-links report
if: steps.lychee.outcome == 'failure'
shell: bash
run: |
mkdir -p lychee
if [ ! -s ./lychee/predeploy-out.md ]; then
cat > ./lychee/predeploy-out.md <<'EOF'
# Link checker failed during release build
The Lychee step failed, but it did not produce a broken-links report file.
Open the linked Actions run and inspect the **Run Lychee pre-deploy gate** step for the exact tool error.
EOF
fi
sed "s|file://${GITHUB_WORKSPACE}/out|https://mindoff.work|g" ./lychee/predeploy-out.md > ./lychee/predeploy-public.md
{
echo "# Broken links detected during release build"
echo
echo "Run: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
echo
echo "If the report below looks incomplete, open the **Run Lychee pre-deploy gate** step in this run for full details."
echo
cat ./lychee/predeploy-public.md
} > ./lychee/predeploy-report.md
- name: Upload release link-check report
if: always()
uses: actions/upload-artifact@v4
with:
name: lychee-release-report
path: |
./lychee/predeploy-out.md
./lychee/predeploy-public.md
./lychee/predeploy-report.md
if-no-files-found: ignore
- name: Stop release when broken links are found
if: steps.lychee.outcome == 'failure'
run: |
echo "Link check failed. Deployment has been stopped."
exit 1
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
cname: mindoff.work
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true