-
Notifications
You must be signed in to change notification settings - Fork 27
49 lines (41 loc) · 1.69 KB
/
build_files.yml
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
name: Build files and push
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'template/README.jinja2'
- 'template/variables.json'
- 'apps/*/variables.json'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get applist
id: getlist
run: |
pip install jinja2-cli
git diff --name-only HEAD^ HEAD
echo "APP_LISTS=$(git diff --name-only HEAD^ HEAD -- 'apps/*/variables.json' | awk -F/ '{print $2}' | tr '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
echo "APP_LISTS_ALL=$(ls -d apps/*/ | cut -f2 -d'/' | tr '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
git diff --name-only HEAD^ HEAD | grep 'template/README.jinja2' && echo "TPL_README=changed" >> $GITHUB_ENV || true
git diff --name-only HEAD^ HEAD | grep 'template/variables.json' && echo "TPL_VARS=changed" >> $GITHUB_ENV || true
- name: Update readme when app's variables.json changed
run: python3 build/update_readme.py "${{ env.APP_LISTS }}"
if: env.APP_LISTS != ''
- name: Update readme when template/README.jinja2 changed
run: python3 build/update_readme.py "${{ env.APP_LISTS_ALL }}"
if: env.TPL_README == 'changed'
- name: Update variables file when when template/variables.json changed
run: python3 build/update_variables.py "${{ env.APP_LISTS_ALL }}"
if: env.TPL_VARS == 'changed'
- name: Commit and push if changed
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update files"
commit_options: "--no-verify --signoff"
push_options: "--force-with-lease"