Repository navigation
64 lines (52 loc) · 1.74 KB
/
Copy pathgenerate-commit-man.yml
File metadata and controls
64 lines (52 loc) · 1.74 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
name: Generate Commit-Man GIF
on:
workflow_dispatch:
push:
branches: [main]
schedule:
- cron: "23 3 * * 0"
permissions:
contents: write
concurrency:
group: commit-man-output
cancel-in-progress: true
jobs:
generate:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm install --no-audit --no-fund
- name: Run tests
run: npm test
- name: Generate animated GIF
env:
GITHUB_USERNAME: codelovingcat
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIF_OUTPUT_PATH: output/commit-man.gif
run: npm run generate:gif
- name: Publish generated GIF
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
mkdir -p output-branch
if git ls-remote --exit-code --heads origin output >/dev/null 2>&1; then
git fetch origin output
git worktree add --detach output-branch origin/output
else
git worktree add --detach output-branch
git -C output-branch checkout --orphan output
git -C output-branch rm -rf . >/dev/null 2>&1 || true
fi
rm -f output-branch/commit-man.gif
cp output/commit-man.gif output-branch/commit-man.gif
git -C output-branch add commit-man.gif
git -C output-branch commit -m "chore: publish Commit-Man animation" || true
git -C output-branch push origin HEAD:output