mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
176 lines
5.4 KiB
YAML
176 lines
5.4 KiB
YAML
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:
|
|
- "@auth/nextjs"
|
|
- "@auth/core"
|
|
- "next-auth"
|
|
# TODO: Infer from package name
|
|
path:
|
|
type: choice
|
|
description: Directory name (packages/*)
|
|
options:
|
|
- "frameworks-nextjs"
|
|
- "core"
|
|
- "next-auth"
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Init
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 2
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.2.4
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: Run tests
|
|
run: pnpm test
|
|
timeout-minutes: 15
|
|
env:
|
|
UPSTASH_REDIS_URL: ${{ secrets.UPSTASH_REDIS_URL }}
|
|
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
|
# - name: Run E2E tests
|
|
# if: github.repository == 'nextauthjs/next-auth'
|
|
# run: pnpm e2e
|
|
# timeout-minutes: 15
|
|
# env:
|
|
# AUTH0_USERNAME: ${{ secrets.AUTH0_USERNAME }}
|
|
# AUTH0_PASSWORD: ${{ secrets.AUTH0_PASSWORD }}
|
|
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
# TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
|
# - name: Upload E2E artifacts
|
|
# if: github.repository == 'nextauthjs/next-auth'
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# name: playwright-report
|
|
# path: apps/dev/nextjs/playwright-report/
|
|
# retention-days: 30
|
|
# - name: Coverage
|
|
# uses: codecov/codecov-action@v1
|
|
# with:
|
|
# directory: ./coverage
|
|
# fail_ci_if_error: false
|
|
release-branch:
|
|
name: Publish branch
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
if: ${{ github.event_name == 'push' }}
|
|
environment: Production
|
|
steps:
|
|
- name: Init
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GH_PAT_CLASSIC }}
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.2.4
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: Publish to npm and GitHub
|
|
run: pnpm release
|
|
env:
|
|
# Use GH_PAT when this is fixed:
|
|
# https://github.com/github/roadmap/issues/622
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT_CLASSIC }}
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
release-pr:
|
|
name: Publish PR
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
environment: Preview
|
|
steps:
|
|
- name: Init
|
|
uses: actions/checkout@v3
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.2.4
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
- 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
|
|
needs: test
|
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
steps:
|
|
- name: Init
|
|
uses: actions/checkout@v3
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.2.4
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: Determine version
|
|
uses: ./.github/version-pr
|
|
id: determine-version
|
|
env:
|
|
PACKAGE_PATH: ${{ github.event.inputs.path }}
|
|
- name: Publish to npm
|
|
run: |
|
|
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 "pnpm add ${{ github.event.inputs.name }}@${{ env.VERSION }}"
|
|
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
PACKAGE_PATH: ${{ github.event.inputs.path }}
|
|
VERSION: ${{ steps.determine-version.outputs.version }}
|