2020-11-08 13:56:02 +01:00
|
|
|
name: Deploy
|
2020-11-13 23:00:53 +01:00
|
|
|
|
2020-11-08 13:56:02 +01:00
|
|
|
on:
|
2020-11-13 23:00:53 +01:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2022-05-06 14:21:58 +02:00
|
|
|
- e/w2
|
2020-11-13 23:00:53 +01:00
|
|
|
repository_dispatch:
|
2021-01-19 00:18:32 +01:00
|
|
|
schedule:
|
|
|
|
- cron: '0 0 1 * *'
|
2020-11-13 23:00:53 +01:00
|
|
|
|
2020-11-08 13:56:02 +01:00
|
|
|
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
|
2020-11-22 15:56:38 +01:00
|
|
|
env:
|
|
|
|
NODE_ENV: production
|
2020-11-08 13:56:02 +01:00
|
|
|
- name: Publish
|
2022-05-06 14:21:58 +02:00
|
|
|
uses: WalshyDev/wrangler-action@walshy/pages-996-support-wrangler2
|
2020-11-08 13:56:02 +01:00
|
|
|
with:
|
|
|
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
2022-05-06 14:21:58 +02:00
|
|
|
command: publish --env production
|
2022-05-06 14:26:23 +02:00
|
|
|
wranglerVersion: beta
|
2020-11-13 23:00:53 +01:00
|
|
|
preCommands: |
|
|
|
|
wrangler kv:namespace create KV_STATUS_PAGE
|
|
|
|
apt-get update && apt-get install -y jq
|
2020-11-18 21:01:56 +01:00
|
|
|
export KV_NAMESPACE_ID=$(wrangler kv:namespace list | jq -c 'map(select(.title | contains("KV_STATUS_PAGE")))' | jq -r ".[0].id")
|
2020-11-13 23:00:53 +01:00
|
|
|
echo "[env.production]" >> wrangler.toml
|
2020-11-18 21:01:56 +01:00
|
|
|
echo "kv_namespaces = [{binding=\"KV_STATUS_PAGE\", id=\"${KV_NAMESPACE_ID}\"}]" >> wrangler.toml
|
2020-11-14 16:41:51 +01:00
|
|
|
[ -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
|
2020-11-22 15:29:22 +01:00
|
|
|
[ -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
|
2021-02-23 13:32:08 +01:00
|
|
|
[ -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
|
2020-11-18 21:01:56 +01:00
|
|
|
postCommands: |
|
|
|
|
yarn kv-gc
|
2020-11-13 23:00:53 +01:00
|
|
|
secrets: |
|
|
|
|
SECRET_SLACK_WEBHOOK_URL
|
2020-11-22 15:29:22 +01:00
|
|
|
SECRET_TELEGRAM_API_TOKEN
|
|
|
|
SECRET_TELEGRAM_CHAT_ID
|
2021-02-23 13:32:08 +01:00
|
|
|
SECRET_DISCORD_WEBHOOK_URL
|
2020-11-08 13:56:02 +01:00
|
|
|
env:
|
|
|
|
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
2020-11-13 23:00:53 +01:00
|
|
|
SECRET_SLACK_WEBHOOK_URL: ${{secrets.SECRET_SLACK_WEBHOOK_URL}}
|
2020-11-22 15:29:22 +01:00
|
|
|
SECRET_TELEGRAM_API_TOKEN: ${{secrets.SECRET_TELEGRAM_API_TOKEN}}
|
|
|
|
SECRET_TELEGRAM_CHAT_ID: ${{secrets.SECRET_TELEGRAM_CHAT_ID}}
|
2021-02-23 13:32:08 +01:00
|
|
|
SECRET_DISCORD_WEBHOOK_URL: ${{secrets.SECRET_DISCORD_WEBHOOK_URL}}
|