-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
255 lines (251 loc) · 8.54 KB
/
release.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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
name: Release
on:
push:
branches:
- main
- beta
- next
- 3.x
pull_request:
# TODO: Support latest releases
workflow_dispatch:
inputs:
name:
type: choice
description: Package name (npm)
options:
- "next-auth"
- "@auth/core"
- "@auth/express"
- "@auth/nuxt"
- "@auth/qwik"
- "@auth/solid-start"
- "@auth/sveltekit"
- "@auth/azure-tables-adapter"
- "@auth/d1-adapter"
- "@auth/dgraph-adapter"
- "@auth/drizzle-adapter"
- "@auth/dynamodb-adapter"
- "@auth/edgedb-adapter"
- "@auth/fauna-adapter"
- "@auth/firebase-adapter"
- "@auth/hasura-adapter"
- "@auth/kysely-adapter"
- "@auth/mikro-orm-adapter"
- "@auth/mongodb-adapter"
- "@auth/neo4j-adapter"
- "@auth/pg-adapter"
- "@auth/pouchdb-adapter"
- "@auth/prisma-adapter"
- "@auth/sequelize-adapter"
- "@auth/supabase-adapter"
- "@auth/surrealdb-adapter"
- "@auth/test-adapter"
- "@auth/typeorm-adapter"
- "@auth/typeorm-legacy-adapter"
- "@auth/unstorage-adapter"
- "@auth/upstash-redis-adapter"
- "@auth/xata-adapter"
permissions:
id-token: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
FORCE_COLOR: true
NPM_CONFIG_PROVENANCE: true
jobs:
test:
name: Test
runs-on: ubuntu-22.04
steps:
- name: Init
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Peek
run: pnpm peek
if: ${{ github.repository == 'nextauthjs/next-auth' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- name: Get base commit SHA from main
id: get_base_sha
run: echo "BASE_SHA=$(git merge-base origin/main HEAD)" >> $GITHUB_ENV
- name: Check for changes under /packages
id: check-packages
run: |
if git diff --name-only ${{ env.BASE_SHA }}...HEAD | grep '^packages/'; then
echo "PACKAGES_CHANGES=true" >> $GITHUB_ENV
else
echo "PACKAGES_CHANGES=false" >> $GITHUB_ENV
fi
- name: Build
if: ${{ env.PACKAGES_CHANGES == 'true' || github.ref == 'refs/heads/main' }}
run: pnpm build
- name: Check formatting
run: pnpm format
timeout-minutes: 15
- name: Run unit tests
if: ${{ env.PACKAGES_CHANGES == 'true' || github.ref == 'refs/heads/main' }}
run: pnpm test
- name: Install Playwright
if: github.repository == 'nextauthjs/next-auth'
run: pnpm exec playwright install --with-deps chromium
- name: Run E2E tests (Nextjs-Docker)
continue-on-error: true
if: false
timeout-minutes: 15
run: cd apps/examples/nextjs-docker && pnpm test:docker
- name: Run E2E tests
continue-on-error: true # TODO: Make this less flakey
if: ${{ env.PACKAGES_CHANGES == 'true' || github.ref == 'refs/heads/main' }}
timeout-minutes: 15
env:
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
TEST_KEYCLOAK_USERNAME: ${{ secrets.TEST_KEYCLOAK_USERNAME }}
TEST_KEYCLOAK_PASSWORD: ${{ secrets.TEST_KEYCLOAK_PASSWORD }}
AUTH_KEYCLOAK_ID: ${{ secrets.AUTH_KEYCLOAK_ID }}
AUTH_KEYCLOAK_SECRET: ${{ secrets.AUTH_KEYCLOAK_SECRET }}
AUTH_KEYCLOAK_ISSUER: ${{ secrets.AUTH_KEYCLOAK_ISSUER }}
AUTH_TRUST_HOST: 1
DEBUG: "pw:webserver"
run: pnpm test:e2e
- uses: actions/upload-artifact@v4
name: Upload Playwright artifacts
with:
name: playwright-traces
path: "**/packages/next-auth/test-results/*/trace.zip"
retention-days: 7
- uses: codecov/codecov-action@v4
if: always()
name: Coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}
release-branch:
name: Publish branch
timeout-minutes: 120
runs-on: ubuntu-latest
needs: test
if: ${{ github.event_name == 'push' }}
environment: Production
steps:
- name: Init
uses: actions/checkout@v4
with:
fetch-depth: 0
# Please upvote https://github.com/orgs/community/discussions/13836
token: ${{ secrets.GH_PAT }}
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Publish to npm and GitHub
run: pnpm release
env:
# Please upvote https://github.com/orgs/community/discussions/13836
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
release-pr:
name: Publish PR
timeout-minutes: 120
runs-on: ubuntu-latest
needs: test
if: ${{ github.event_name == 'pull_request' }}
environment: Preview
steps:
- name: Init
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Determine version
uses: ./.github/version-pr
id: determine-version
env:
PR_NUMBER: ${{ github.event.number }}
- name: Publish to npm
run: |
cd packages/core
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
pnpm publish --no-git-checks --access public --tag experimental
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Comment version on PR
uses: NejcZdovc/comment-pr@v2
with:
message:
"🎉 Experimental release [published 📦️ on npm](https://npmjs.com/package/@auth/core/v/${{ env.VERSION }})!\n \
```sh\npnpm add @auth/core@${{ env.VERSION }}\n```\n \
```sh\nyarn add @auth/core@${{ env.VERSION }}\n```\n \
```sh\nnpm i @auth/core@${{ env.VERSION }}\n```"
env:
VERSION: ${{ steps.determine-version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
release-manual:
name: Publish manually
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Init
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Map package name to path
run: |
case "${{ github.event.inputs.name }}" in
*"-adapter")
adapter_name=$(echo "${{ github.event.inputs.name }}" | sed 's/@auth\///' | sed 's/-adapter//')
echo "PACKAGE_PATH=adapter-${adapter_name}" >> $GITHUB_ENV
;;
"next-auth")
echo "PACKAGE_PATH=next-auth" >> $GITHUB_ENV
;;
"@auth/core")
echo "PACKAGE_PATH=core" >> $GITHUB_ENV
;;
*)
framework_name=$(echo "${{ github.event.inputs.name }}" | sed 's/@auth\///')
echo "PACKAGE_PATH=frameworks-${framework_name}" >> $GITHUB_ENV
;;
esac
- name: Determine version
uses: ./.github/version-pr
id: determine-version
env:
PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
- name: Publish to npm
run: |
pnpm build
cd packages/$PACKAGE_PATH
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
pnpm publish --no-git-checks --access public --tag experimental
echo "🎉 Experimental release published 📦️ on npm: https://npmjs.com/package/${{ github.event.inputs.name }}/v/${{ env.VERSION }}"
echo "Install via: pnpm add ${{ github.event.inputs.name }}@${{ env.VERSION }}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PACKAGE_PATH: ${{ env.PACKAGE_PATH }}
VERSION: ${{ steps.determine-version.outputs.version }}