85 lines
2.8 KiB
YAML
85 lines
2.8 KiB
YAML
name: update (hourly)
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
force:
|
|
description: Force update regardless of "bun run check"
|
|
default: false
|
|
required: false
|
|
type: boolean
|
|
quiet:
|
|
description: Disable sending any messages
|
|
default: false
|
|
required: false
|
|
type: boolean
|
|
schedule:
|
|
- cron: "30 * * * *"
|
|
|
|
jobs:
|
|
check-update:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: main
|
|
path: main
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: data
|
|
path: data
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: canvas
|
|
path: canvas
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
|
|
- working-directory: main
|
|
run: bun install
|
|
|
|
- name: Setup Git
|
|
working-directory: data
|
|
run: |
|
|
git config user.name github-actions
|
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
git -C ../canvas config user.name github-actions
|
|
git -C ../canvas config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
|
|
- name: Check for version
|
|
id: check
|
|
working-directory: main
|
|
run: |
|
|
version=$(bun run check ${{ github.event.inputs.force == 'true' && '--force' || '' }})
|
|
echo "[DEBUG]: Check result: $version"
|
|
echo "version=$version" >> $GITHUB_OUTPUT
|
|
|
|
- name: Update
|
|
if: ${{ steps.check.outputs.version != 'false' }}
|
|
env:
|
|
code_webhook: ${{ secrets.CODE_WEBHOOK }}
|
|
bot_token: ${{ secrets.BOT_TOKEN }}
|
|
working-directory: main
|
|
run: bun run update:prod ${{ github.event.inputs.quiet == 'true' && '--quiet' || '' }}
|
|
|
|
- name: Publish changes
|
|
if: ${{ steps.check.outputs.version != 'false' }}
|
|
working-directory: data
|
|
run: git push
|
|
|
|
- name: Publish canvas
|
|
if: ${{ steps.check.outputs.version != 'false' }}
|
|
working-directory: canvas
|
|
run: git push
|
|
|
|
- name: Tag changes
|
|
if: ${{ steps.check.outputs.version != 'false' }}
|
|
working-directory: data
|
|
run: |
|
|
git tag -f ${{ steps.check.outputs.version }}
|
|
git push origin -f ${{ steps.check.outputs.version }}
|