Skip to content

Commit

Permalink
gh-action: weekly workers & fly prod deploys
Browse files Browse the repository at this point in the history
runs a day or two after serverless-dns/blocklists generates new blocklist trie
  • Loading branch information
ignoramous committed Sep 23, 2023
1 parent 5ff900f commit 47a9bf1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/cf.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: ⛅ CF
on:
# github.com/serverless-dns/blocklists/blob/6021f80f/.github/workflows/createUploadBlocklistFilter.yml#L4-L6
schedule:
# at 7:53 on 3rd, 10th, 18th, 26th of every month
- cron: '53 7 3,10,18,26 * *'
# docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
# docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_dispatch
# docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
Expand Down Expand Up @@ -57,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
- name: 🛒 Checkout
uses: actions/checkout@v3.3.0
with:
ref: ${{ env.GIT_REF }}
Expand Down Expand Up @@ -86,20 +90,31 @@ jobs:
WENV: 'prod'
COMMIT_SHA: ${{ github.sha }}

- name: 🌽 Cron?
if: github.event.schedule == '53 7 3,10,18,26 * *'
run: |
echo "WORKERS_ENV=${WENV}" >> $GITHUB_ENV
echo "COMMIT_SHA=${COMMIT_SHA}" >> $GITHUB_ENV
shell: bash
env:
# cron deploys always deploy to prod
WENV: 'prod'
COMMIT_SHA: ${{ github.sha }}

# npm (and node16) are installed by wrangler-action in a pre-job setup
- name: 🏗 Get dependencies
run: npm i

- name: 📚 Wrangler publish
# github.com/cloudflare/wrangler-action
uses: cloudflare/wrangler-action@2.0.0
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
# input overrides env-defaults, regardless
environment: ${{ env.WORKERS_ENV }}
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
GIT_COMMIT_ID: ${{ env.GIT_REF }}
GIT_COMMIT_ID: ${{ env.COMMIT_SHA }}

- name: 🎤 Notice
run: |
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/fly.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: 🪂 Fly

on:
# github.com/serverless-dns/blocklists/blob/6021f80f/.github/workflows/createUploadBlocklistFilter.yml#L4-L6
schedule:
# at 7:53 on 2nd, 9th, 17th, 25th of every month
- cron: '53 7 2,9,17,25 * *'
push:
branches:
- "main"
Expand Down Expand Up @@ -121,6 +125,15 @@ jobs:
env:
COMMIT_SHA: ${{ github.sha }}

- name: 🚨🌽 Prod via cron?
if: github.event.schedule == '53 7 2,9,17,25 * *'
run: |
echo "FLY_APP=${FLY_PROD_APP}" >> $GITHUB_ENV
echo "::notice::Deploying PROD / ${GIT_REF} @ ${COMMIT_SHA}"
shell: bash
env:
COMMIT_SHA: ${{ github.sha }}

- name: 🚜👨‍🚒 Onebox via dispatch?
if: ${{ github.event_name == 'workflow_dispatch' &&
github.event.inputs.deployment-type == 'onebox' }}
Expand Down

0 comments on commit 47a9bf1

Please sign in to comment.