Update Themes #837
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: Update Themes | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 1 * * *' | |
jobs: | |
update_list: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17.x | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Clone the main repo | |
run: | | |
git clone https://github.com/themercorp/themer.lua --depth 1 | |
- name: Copy themes | |
run: | | |
cp themer.lua/lua/themer/modules/themes . -r | |
rm themer.lua -rf | |
- name: Generate JSON template | |
run: | | |
sudo apt install lua5.3 -y > /dev/null | |
rm generated_templates/* | |
lua generate_template.lua | |
- name: Mustache | |
run: | | |
go install github.com/cbroglie/mustache/cmd/mustache@latest | |
rm user_css/* | |
for i in $(\ls generated_templates/); do | |
mustache generated_templates/${i} templates/default.mustache >> "user_css/$(echo $i | sed 's/\.json//g').user.css" | |
done | |
- name: Push Changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COMMIT_MSG: | | |
[bot] update themes | |
skip-checks: true | |
run: | | |
git config user.email "actions@github" | |
git config user.name "Github Actions" | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
git add . | |
# Only commit and push if we have changes | |
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:${GITHUB_REF}) |