Skip to content

generate-json

generate-json #146

Workflow file for this run

name: generate-json
on:
workflow_dispatch:
schedule:
- cron: "15 20 7,15,22,26-27,29-30 * *"
jobs:
check:
runs-on: ubuntu-latest
outputs:
cndate: ${{ steps.valid.outputs.cndate }}
steps:
- id: valid
name: Get date
run: |
date +"%F %T" && TZ='Asia/Shanghai' date +"%F %T" # for debug
echo "cndate=$(TZ='Asia/Shanghai' date +%F)" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: check
if: github.event_name != 'schedule' || endsWith(needs.check.outputs.cndate, '01') || endsWith(needs.check.outputs.cndate, '08') || endsWith(needs.check.outputs.cndate, '16') || endsWith(needs.check.outputs.cndate, '23')
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ACCESS_TOKEN || github.token }}
- uses: pnpm/action-setup@v2
with:
version: 6.32.9
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
- name: Install
run: pnpm install --frozen-lockfile
- name: Build
env:
HHW_LANG: ${{ secrets.HHW_LANG }}
run: pnpm test
- name: Upload
uses: tvrcgo/upload-to-oss@master
with:
key-id: ${{ secrets.OSS_KEY_ID }}
key-secret: ${{ secrets.OSS_KEY_SECRET }}
region: oss-cn-shanghai
bucket: monsterx
assets: |
assets/abyss.json:/bot/abyss.json
assets/abyss.live.json:/bot/abyss.live.json
assets/abyss.beta.json:/bot/abyss.beta.json
assets/abyss.beautify.json:/bot/abyss.beautify.json
assets/abyss.json:/bot/gsabyss/abyss.json
- name: Commit
uses: EndBug/add-and-commit@main
with:
author_name: github-actions[bot]
author_email: github-actions[bot]@users.noreply.github.com
message: ':bento: update spiral abyss data'
add: 'assets/*.json'