Skip to content

chore(worker): update CI #15

chore(worker): update CI

chore(worker): update CI #15

Workflow file for this run

name: Deploy Worker
on:
push:
pull_request:
repository_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
# For Workers Deployment fork only
if: github.repository != 'Gowee/zhconv-rs'
timeout-minutes: 60
steps:
# - run: echo '${{ toJSON(github.event) }}' | jq .
- uses: actions/checkout@v2
- name: Activate OpenCC Dicts
run: sed -i 's/default = \[/\0"opencc"/' worker/Cargo.toml
- name: Disable other workflows in Workers fork
if: github.run_number == 1 && github.event_name == 'repository_dispatch' && github.event.repository.fork == true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
flows=$(gh workflow list --json 'name,id' --jq '.[] | select(.name != "${{ github.workflow }}") | .id')
echo "Workflows to disable: $flows"
for flow in $flows; do
gh workflow disable $flow
done
# runs=$(gh run list --json 'databaseId' --jq '.[] | select(.databaseId != ${{ github.run_id }}) | .databaseId')
# echo "Runs to cancel: $runs"
# for run in $runs; do
# gh run cancel $run
# done
- name: Build & Deploy Worker
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: worker