ci: auto bump changed userstyles on pr merge (#1535)

This commit is contained in:
uncenter authored and GitHub committed 2024-12-28 18:13:19 -05:00
1 parent fb505120bd
commit ab27cffd88
1 file changed
+16 -6
+68
View File
@@ -0,0 +1,68 @@
name: CI
on:
workflow_dispatch:
push:
branches: [main]
env:
HAS_USERSTYLES_TOKEN: ${{ secrets.USERSTYLES_TOKEN != '' }}
jobs:
ci:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- uses: actions/checkout@v4
if: env.HAS_USERSTYLES_TOKEN
with:
token: ${{ secrets.USERSTYLES_TOKEN }}
ref: ${{ github.ref }}
- uses: actions/checkout@v4
if: env.HAS_USERSTYLES_TOKEN == 'false'
with:
ref: ${{ github.ref }}
- name: Setup Deno
uses: nekowinston/setup-deno@main
with:
deno-version: v2.1.3
- name: Bump changed userstyles
run: |
git diff --name-only HEAD^1 HEAD | grep '^styles/.*catppuccin\.user\.css$' | xargs deno task bump
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: "chore: bump changed userstyles"
default_author: github_actions
push: false
- name: Update generated files
run: deno task generate
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: "chore: update generated files"
default_author: github_actions
push: false
- name: Format files
run: deno task format
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: "style: format with prettier"
default_author: github_actions
push: false
- name: Push changes
if: ${{ github.repository == 'catppuccin/userstyles' && github.ref == 'refs/heads/main' && env.HAS_USERSTYLES_TOKEN }}
run: git push origin "HEAD:${{ github.ref }}" --atomic