mirror of
https://github.com/tormachris/cf-workers-status-page.git
synced 2024-11-01 05:46:09 +01:00
54 lines
2.3 KiB
YAML
54 lines
2.3 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- e/w2
|
|
repository_dispatch:
|
|
schedule:
|
|
- cron: '0 0 1 * *'
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 12
|
|
- run: yarn install
|
|
- run: yarn build
|
|
env:
|
|
NODE_ENV: production
|
|
- name: Publish
|
|
uses: WalshyDev/wrangler-action@walshy/pages-996-support-wrangler2
|
|
with:
|
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
|
command: publish --env production
|
|
wranglerVersion: beta
|
|
preCommands: |
|
|
wrangler kv:namespace create KV_STATUS_PAGE
|
|
apt-get update && apt-get install -y jq
|
|
export KV_NAMESPACE_ID=$(wrangler kv:namespace list | jq -c 'map(select(.title | contains("KV_STATUS_PAGE")))' | jq -r ".[0].id")
|
|
echo "[env.production]" >> wrangler.toml
|
|
echo "kv_namespaces = [{binding=\"KV_STATUS_PAGE\", id=\"${KV_NAMESPACE_ID}\"}]" >> wrangler.toml
|
|
[ -z "$SECRET_SLACK_WEBHOOK_URL" ] && echo "Secret SECRET_SLACK_WEBHOOK_URL not set, creating dummy one..." && SECRET_SLACK_WEBHOOK_URL="default-gh-action-secret" || true
|
|
[ -z "$SECRET_TELEGRAM_API_TOKEN" ] && echo "Secret SECRET_TELEGRAM_API_TOKEN not set, creating dummy one..." && SECRET_TELEGRAM_API_TOKEN="default-gh-action-secret" || true
|
|
[ -z "$SECRET_TELEGRAM_CHAT_ID" ] && echo "Secret SECRET_TELEGRAM_CHAT_ID not set, creating dummy one..." && SECRET_TELEGRAM_CHAT_ID="default-gh-action-secret" || true
|
|
[ -z "$SECRET_DISCORD_WEBHOOK_URL" ] && echo "Secret SECRET_DISCORD_WEBHOOK_URL not set, creating dummy one..." && SECRET_DISCORD_WEBHOOK_URL="default-gh-action-secret" || true
|
|
postCommands: |
|
|
yarn kv-gc
|
|
secrets: |
|
|
SECRET_SLACK_WEBHOOK_URL
|
|
SECRET_TELEGRAM_API_TOKEN
|
|
SECRET_TELEGRAM_CHAT_ID
|
|
SECRET_DISCORD_WEBHOOK_URL
|
|
env:
|
|
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
|
SECRET_SLACK_WEBHOOK_URL: ${{secrets.SECRET_SLACK_WEBHOOK_URL}}
|
|
SECRET_TELEGRAM_API_TOKEN: ${{secrets.SECRET_TELEGRAM_API_TOKEN}}
|
|
SECRET_TELEGRAM_CHAT_ID: ${{secrets.SECRET_TELEGRAM_CHAT_ID}}
|
|
SECRET_DISCORD_WEBHOOK_URL: ${{secrets.SECRET_DISCORD_WEBHOOK_URL}}
|