Skip to content

reg: m fix import

reg: m fix import #131

Workflow file for this run

name: ⛅ CF
on:
workflow_dispatch:
inputs:
# docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
environment:
description: 'wrangler env to deploy to'
required: true
default: 'dev'
type: choice
options:
- dev
- prod
commit:
description: 'git tip commit to deploy'
default: 'main'
required: true
push:
# TODO: inputs.environment and inputs.commit
branches:
- "main"
tags:
- "v*"
paths-ignore:
- ".github/**"
- "!.github/workflows/cf.yml"
- "scripts/**"
- ".eslintrc.cjs"
- ".prettierignore"
- "README.md"
- ".vscode/*"
- ".husky/*"
- ".prettierrc.json"
- "LICENSE"
repository_dispatch:
env:
GIT_REF: ${{ github.event.inputs.commit || github.ref }}
WRANGLER_VER: '4.72.0'
# default is 'dev' which is really empty/no env
WORKERS_ENV: ''
jobs:
deploy:
name: 🏇 Deploy
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ env.GIT_REF }}
fetch-depth: 0
- name: 🎱 Tag?
# docs.github.com/en/actions/learn-github-actions/contexts#github-context
if: github.ref_type == 'tag' || github.event.inputs.environment == 'prod'
run: |
echo "WORKERS_ENV=${WENV}" >> $GITHUB_ENV
echo "COMMIT_SHA=${COMMIT_SHA}" >> $GITHUB_ENV
shell: bash
env:
# tagged deploy default to prod
WENV: 'prod'
COMMIT_SHA: ${{ github.sha }}
- name: 🏗 Prepare
run: npm i
- name: 📚 Publish
# github.com/cloudflare/wrangler-action
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
# input overrides env-defaults, regardless
environment: ${{ env.WORKERS_ENV }}
wranglerVersion: ${{ env.WRANGLER_VER }}
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
GIT_COMMIT_ID: ${{ env.GIT_REF }}
- name: ⛳️ Notice
if: ${{ success() }}
run: |
echo "::notice::Deployed to ${WORKERS_ENV} / ${GIT_REF} @ ${COMMIT_SHA}"