feat(worker): represent bool with 0&1 in API query #19
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: 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 set an API token, run `wrangler secret put API_TOKEN` locally |