Scheduler #28
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@v3 | |
with: | |
name: generated | |
path: | | |
${{ github.workspace }}/sponsors.* | |
update-sponsors: | |
runs-on: ubuntu-latest | |
name: Update sponsors | |
needs: generate-sponsors | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: assets | |
- name: Download results | |
uses: actions/download-artifact@v3 | |
with: | |
name: generated | |
path: ${{ 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 sponsors.* | |
git diff-index --quiet HEAD || git commit -m ":money_with_wings: update sponsors.svg" | |
git push |