-
Notifications
You must be signed in to change notification settings - Fork 67
59 lines (49 loc) · 1.59 KB
/
ci.yaml
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
name: Generate and push
on:
workflow_dispatch:
push:
paths:
- '**.py'
- 'images/**'
- 'config.toml'
branches:
- main
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate:
if: "!contains(github.event.commits[0].message, '[Generate]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup python
uses: actions/setup-python@v2
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v3
with:
path: "scripts/requirements.txt"
- name: Generate json
run: python scripts/generate_json.py
shell: sh
- name: fetch from master
run: git fetch origin main
- name: Generate Pixelart
run: python scripts/render_json.py
shell: sh
- name: Commit files if changed
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions[bot]"
git update-index -q --refresh
git diff-index --quiet HEAD -- || git commit -m "[Generate]" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main