-
Notifications
You must be signed in to change notification settings - Fork 5
41 lines (40 loc) · 1.6 KB
/
worker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
# Note:
# To activate authentication, set the `API_TOKEN` secret, via the CF dashboard or `wrangler secret put API_TOKEN`.
# To change the 2MiB default request body limit, set the `BODY_LIMIT` envvar, via the dashboard or wrangler.toml.