forked from erikhenrique/bin-cc
-
Notifications
You must be signed in to change notification settings - Fork 5
54 lines (45 loc) · 1.39 KB
/
Copy pathpublish.yml
File metadata and controls
54 lines (45 loc) · 1.39 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
name: Publish Compiled Data
on:
workflow_run:
workflows: ["CI"]
types:
- completed
branches: [ main, master ]
jobs:
# Commit compiled data after CI passes
publish:
name: Publish Compiled Data
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install dependencies
run: npm install --ignore-scripts
- name: Build data files
run: npm run build
- name: Check for changes
id: check_changes
run: |
git add -A
if git diff --staged --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes to commit"
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "Changes detected:"
git diff --staged --name-only
fi
- name: Commit and push
if: steps.check_changes.outputs.changes == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "chore: update compiled data files [skip ci]"
git push