-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (91 loc) · 2.62 KB
/
worker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Cloudflare worker
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: "0 0 * * SUN"
permissions: {}
defaults:
run:
shell: bash
jobs:
test-worker:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read # for checkout
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
mise.toml
tasks.toml
tasks/*
worker/*
sparse-checkout-cone-mode: false
- run: ls -al
- name: Install mise
uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8
with:
version: 2024.12.8
cache_save: ${{ github.ref_name == 'main' }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Run tests
run: mise run worker:test:ci
deploy-worker:
needs:
- test-worker
# skip for main branch as Cloudflare workers builds will deploy automatically
if: github.event_name != 'push'
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read # for checkout
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
mise.toml
tasks.toml
tasks/*
worker/*
sparse-checkout-cone-mode: false
- name: Install mise
uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8
with:
version: 2024.12.8
cache_save: ${{ github.ref_name == 'main' }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install package.json dependencies
run: mise run buni:worker
- name: Get Wrangler args
id: wrangler-args
run: |
args=$(mise run worker:wrangler-args)
echo "args=${args}" >> "${GITHUB_OUTPUT}"
- name: Deploy to Cloudflare workers with Wrangler
uses: cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3.13.0
with:
workingDirectory: worker
command: deploy --dry-run ${{ steps.wrangler-args.outputs.args }}
actions-timeline:
needs:
- deploy-worker
if: ${{ !cancelled() }}
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
actions: read # for actions-timeline
steps:
- name: actions-timeline
# cspell:ignore kesin
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1