Merge pull request #1012 from Websoft9/update-vaultwarden-31680a92 #291
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |