remove /image #8
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 to cloudflare workers | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- name: github release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
publish: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- id: node-modules-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
restore-keys: node-modules- | |
- name: cloudflare workers publish | |
uses: cloudflare/wrangler-action@2.0.0 | |
with: | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
preCommands: | | |
# wrangler kv:namespace create KV_GET_SET | |
# wrangler kv:namespace create KV_UID_DATA | |
# uncomment this for one build to enable KV | |
# echo 'import{stdin,stdout}from"process";(async()=>{let t="";for await(const i of stdin)t+=i;return t})().then((t=>{stdout.write(JSON.stringify(JSON.parse(t).filter((t=>t.title.includes("KV_GET_SET")))[0].id))}));' > get_kv_id.mjs | |
# echo 'import{stdin,stdout}from"process";(async()=>{let t="";for await(const i of stdin)t+=i;return t})().then((t=>{stdout.write(JSON.stringify(JSON.parse(t).filter((t=>t.title.includes("KV_UID_DATA")))[0].id))}));' > get_kv_id2.mjs | |
# export KV_NAMESPACE_ID=$(wrangler kv:namespace list | node get_kv_id.mjs) | |
# export KV_NAMESPACE_ID2=$(wrangler kv:namespace list | node get_kv_id2.mjs) | |
# echo "kv_namespaces = [{binding=\"KV_GET_SET\", id=${KV_NAMESPACE_ID}},{binding=\"KV_UID_DATA\", id=${KV_NAMESPACE_ID2}}]" >> wrangler.toml | |
[ -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 | |
secrets: | | |
SECRET_TELEGRAM_API_TOKEN | |
SECRET_TELEGRAM_API_TOKEN2 | |
SECRET_TELEGRAM_API_TOKEN3 | |
env: | |
SECRET_TELEGRAM_API_TOKEN: ${{ secrets.SECRET_TELEGRAM_API_TOKEN }} | |
SECRET_TELEGRAM_API_TOKEN2: ${{ secrets.SECRET_TELEGRAM_API_TOKEN2 }} | |
SECRET_TELEGRAM_API_TOKEN3: ${{ secrets.SECRET_TELEGRAM_API_TOKEN3 }} |