Skip to content

Commit 24e25b6

Browse files
committed
add cloudflare publish workflow
1 parent 9f14749 commit 24e25b6

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: deploy to cloudflare workers
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 'latest'
15+
- name: github release
16+
if: startsWith(github.ref, 'refs/tags/')
17+
uses: softprops/action-gh-release@v1
18+
with:
19+
token: ${{ secrets.GH_TOKEN }}
20+
publish:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 5
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 'latest'
28+
- id: node-modules-cache
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
node_modules
33+
key: node-modules-${{ hashFiles('package-lock.json') }}
34+
restore-keys: node-modules-
35+
- name: cloudflare workers publish
36+
uses: cloudflare/wrangler-action@v3
37+
with:
38+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
39+
preCommands: |
40+
[ -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
41+
secrets: |
42+
SECRET_TELEGRAM_API_TOKEN
43+
env:
44+
SECRET_TELEGRAM_API_TOKEN: ${{ secrets.SECRET_TELEGRAM_API_TOKEN }}

0 commit comments

Comments
 (0)