Scheduler #542
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: [main] | |
jobs: | |
generate-sponsors: | |
runs-on: ubuntu-latest | |
name: Generate sponsors | |
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_USER_ID: ${{ secrets.SPONSORKIT_AFDIAN_USER_ID }} | |
SPONSORKIT_AFDIAN_TOKEN: ${{ secrets.SPONSORKIT_AFDIAN_TOKEN }} | |
SPONSORKIT_AFDIAN_EXECHANGERATE: 1 | |
SPONSORKIT_AFDIAN_WEB_AUTH_TOKEN: ${{ secrets.SPONSORKIT_AFDIAN_WEB_AUTH_TOKEN }} | |
SPONSORKIT_MOONCELL_PATH: './assets/data.csv' | |
- name: Upload generated files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated | |
path: | | |
${{ github.workspace }}/sponsors.* | |
update-sponsors: | |
runs-on: ubuntu-latest | |
name: Update sponsors | |
needs: generate-sponsors | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup OSS | |
uses: ./.github/actions/setup-oss | |
with: | |
ossutil-config: ${{ secrets.OSSUTIL_CONFIG }} | |
- name: Download results | |
uses: actions/download-artifact@v4 | |
with: | |
name: generated | |
path: ${{ github.workspace }}/generated | |
- name: Upload to OSS | |
run: | | |
shopt -s extglob | |
for file in ${{ github.workspace }}/generated/!(*/); do | |
ossutil64 cp -f $file ${{ secrets.OSS_REMOTE_PATH }} | |
done | |
shell: bash |