Scheduler #440
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: Scheduler | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
push: | |
branches: [master] | |
jobs: | |
generate-sponsors: | |
runs-on: ubuntu-latest | |
name: Generate sponsors | |
environment: sponsor | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: ./.github/actions/setup-node | |
- name: Setup CJK fonts | |
uses: ./.github/actions/setup-fonts | |
- name: Update sponsors | |
run: pnpm run build | |
env: | |
SPONSORKIT_AFDIAN_TOKEN: ${{ secrets.AFDIAN_TOKEN }} | |
SPONSORKIT_AFDIAN_USER_ID: ${{ secrets.AFDIAN_USER_ID }} | |
SPONSORKIT_AFDIAN_EXECHANGERATE: 7 | |
SPONSORKIT_OPENCOLLECTIVE_KEY: ${{ secrets.OPENCOLLECTIVE_KEY }} | |
SPONSORKIT_OPENCOLLECTIVE_SLUG: ${{ secrets.OPENCOLLECTIVE_SLUG }} | |
SPONSORKIT_OPENCOLLECTIVE_TYPE: person | |
- name: Upload generated files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated-sponsors | |
path: | | |
${{ github.workspace }}/sponsors.* | |
if-no-files-found: error | |
retention-days: 1 | |
generate-static-files: | |
runs-on: ubuntu-latest | |
name: Generate static files | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Upload static files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated-static-files | |
path: | | |
${{ github.workspace }}/static/ | |
retention-days: 1 | |
update-sponsors: | |
runs-on: ubuntu-latest | |
name: Update sponsors | |
needs: generate-sponsors | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: assets | |
- name: Clear files | |
run: rm -r ./* | |
- name: Download sponsors | |
uses: actions/download-artifact@v4 | |
with: | |
name: generated-sponsors | |
path: ${{ github.workspace }} | |
- name: Download static files | |
uses: actions/download-artifact@v4 | |
with: | |
name: generated-static-files | |
path: /tmp | |
- run: | | |
mv /tmp/static/* ${{ github.workspace }} | |
- name: Push generated files | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git add . | |
git diff-index --quiet HEAD || git commit -m ":bento: update assets" | |
git push |