-
-
Notifications
You must be signed in to change notification settings - Fork 10
220 lines (208 loc) · 6.31 KB
/
Copy pathmain.yaml
File metadata and controls
220 lines (208 loc) · 6.31 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: main
on:
push:
branches:
- "main"
- "*.*-maintenance"
tags:
- "*.*.*"
pull_request:
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_DB: botkit_test
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:8
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
permissions:
checks: write
pull-requests: write
env:
POSTGRES_URL: postgres://postgres:postgres@localhost:5432/botkit_test
REDIS_URL: redis://localhost:6379/0
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v4
with:
cache: true
- run: mise run test:deno -- --coverage --junit-path=junit.xml
env:
RUST_BACKTRACE: ${{ runner.debug }}
- uses: EnricoMi/publish-unit-test-result-action@v2
with:
check_name: "Test Results"
files: junit.xml
continue-on-error: true
- if: '!cancelled()'
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- run: deno coverage --lcov > coverage.lcov
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.lcov
- run: mise run test:node
- run: mise run check
publish:
if: github.event_name == 'push'
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v4
with:
cache: true
- if: github.ref_type == 'branch'
run: |
set -euo pipefail
jq \
--arg build "$GITHUB_RUN_NUMBER" \
--arg commit "${GITHUB_SHA::8}" \
'.version = .version + "-dev." + $build + "+" + $commit' \
packages/botkit/deno.json > deno.json.tmp
mv deno.json.tmp packages/botkit/deno.json
mise run check-versions -- --fix
- if: github.ref_type == 'tag'
run: |
set -euo pipefail
[[ "$(jq -r .version packages/botkit/deno.json)" = "$GITHUB_REF_NAME" ]]
mise run check-versions
- run: |
set -euo pipefail
if [[ "$GITHUB_REF_TYPE" = tag ]]; then
pnpm publish --recursive --access public --no-git-checks
else
pnpm publish --recursive --access public --no-git-checks --tag dev
fi
env:
NPM_CONFIG_PROVENANCE: "true"
- run: |
set -euo pipefail
max_attempts=30
timeout_seconds=60
for attempt in $(seq 1 "$max_attempts"); do
echo "Publishing to JSR (attempt $attempt/$max_attempts)..."
set +e
timeout --foreground "${timeout_seconds}s" deno publish --allow-dirty
status=$?
set -e
if [[ "$status" -eq 0 ]]; then
exit 0
fi
if [[ "$attempt" -eq "$max_attempts" ]]; then
echo "deno publish failed after $max_attempts attempts."
exit "$status"
fi
if [[ "$status" -eq 124 ]]; then
echo "deno publish timed out after ${timeout_seconds}s; retrying."
else
echo "deno publish failed with exit code $status; retrying."
fi
sleep 5
done
- if: github.ref_type == 'tag'
id: extract-changelog
uses: dahlia/submark@ed8f47b4d51fda07e12b6e991641a8bd5ec62f8e
with:
input-file: CHANGES.md
heading-level: 2
heading-title-text: version ${{ github.ref_name }}
ignore-case: true
omit-heading: true
- if: github.ref_type == 'tag'
run: 'cat "$CHANGES_FILE"'
env:
CHANGES_FILE: ${{ steps.extract-changelog.outputs.output-file }}
- if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
body_path: ${{ steps.extract-changelog.outputs.output-file }}
name: BotKit ${{ github.ref_name }}
generate_release_notes: false
publish-docs:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: [publish]
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v4
with:
cache: true
- run: mise run docs:build
env:
JSR_REF_VERSION: stable
PLAUSIBLE_DOMAIN: ${{ vars.PLAUSIBLE_DOMAIN }}
SITEMAP_HOSTNAME: https://${{ vars.PLAUSIBLE_DOMAIN }}
- id: upload
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
- id: deploy
uses: actions/deploy-pages@v4
publish-canary-docs:
if: github.event_name == 'push' && github.ref_type == 'branch'
needs: [publish]
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
statuses: write
environment:
name: netlify-canary
url: https://canary.botkit.fedify.dev
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v4
with:
cache: true
- run: mise run docs:build
env:
JSR_REF_VERSION: unstable
PLAUSIBLE_DOMAIN: ${{ vars.CANARY_PLAUSIBLE_DOMAIN }}
SITEMAP_HOSTNAME: https://canary.botkit.fedify.dev
- uses: nwtgck/actions-netlify@v4.0.0
with:
publish-dir: docs/.vitepress/dist
production-branch: ${{ github.ref_name }}
production-deploy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: Deploy canary docs from GitHub Actions
enable-pull-request-comment: false
enable-commit-comment: false
overwrites-pull-request-comment: true
github-deployment-environment: netlify-canary
github-deployment-description: Canary documentation
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# cSpell: ignore submark softprops pipefail npmjs nwtgck Netlify