Skip to content

Commit e3064ee

Browse files
authored
ci: add preview releases stub (#2)
* ci: add preview releases stub * ci: adjust existing workflow
1 parent 1a70ee8 commit e3064ee

2 files changed

Lines changed: 50 additions & 90 deletions

File tree

.github/workflows/pkg.pr.new.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish Commit
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
tags:
7+
- '!**'
8+
pull_request:
9+
10+
env:
11+
# NODE_VER: 24.14
12+
NODE_VER: 18.20
13+
WORKING_DIR: packages/next-auth
14+
15+
defaults:
16+
run:
17+
working-directory: ${{ env.WORKING_DIR }}
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
25+
26+
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320
27+
name: Install pnpm
28+
with:
29+
run_install: false
30+
# cache-dependency-path: ${{ env.WORKING_DIR }}/pnpm-lock.yaml
31+
32+
- name: Use Node.js ${{ env.NODE_VER }}
33+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
34+
with:
35+
node-version: ${{ env.NODE_VER }}
36+
cache: pnpm
37+
# cache-dependency-path: ${{ env.WORKING_DIR }}/pnpm-lock.yaml
38+
39+
- name: Install deps
40+
run: pnpm i
41+
42+
# - name: Build and pack
43+
# run: pnpm prepack
44+
45+
# - name: Publish package preview
46+
# run: pnpx pkg-pr-new publish --compact

.github/workflows/release.yml

Lines changed: 4 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -17,103 +17,17 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Init
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
2121
with:
2222
fetch-depth: 2
2323
- name: Install pnpm
24-
uses: pnpm/action-setup@v4.0.0
24+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320
2525
- name: Setup Node
26-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
2727
with:
2828
node-version: 18
29-
cache: "pnpm"
29+
cache: pnpm
3030
- name: Install dependencies
3131
run: pnpm install
3232
- name: Build
3333
run: pnpm build
34-
env:
35-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
36-
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
37-
- name: Run tests
38-
run: pnpm test
39-
env:
40-
UPSTASH_REDIS_URL: ${{ secrets.UPSTASH_REDIS_URL }}
41-
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
42-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
43-
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
44-
# - name: Coverage
45-
# uses: codecov/codecov-action@v1
46-
# with:
47-
# directory: ./coverage
48-
# fail_ci_if_error: false
49-
release-branch:
50-
name: Publish branch
51-
runs-on: ubuntu-latest
52-
needs: test
53-
if: ${{ github.event_name == 'push' }}
54-
environment: Production
55-
steps:
56-
- name: Init
57-
uses: actions/checkout@v3
58-
with:
59-
fetch-depth: 0
60-
- name: Install pnpm
61-
uses: pnpm/action-setup@v4.0.0
62-
- name: Setup Node
63-
uses: actions/setup-node@v3
64-
with:
65-
node-version: 18
66-
cache: "pnpm"
67-
- name: Install dependencies
68-
run: pnpm install
69-
- name: Publish to npm and GitHub
70-
run: |
71-
git config --global user.email "balazsorban44@users.noreply.github.com"
72-
git config --global user.name "Balázs Orbán"
73-
pnpm release
74-
env:
75-
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
76-
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
77-
NPM_TOKEN_PKG: ${{ secrets.NPM_TOKEN_PKG }}
78-
NPM_TOKEN_ORG: ${{ secrets.NPM_TOKEN_ORG }}
79-
release-pr:
80-
name: Publish PR
81-
runs-on: ubuntu-latest
82-
needs: test
83-
if: ${{ github.event_name == 'pull_request' }}
84-
environment: Preview
85-
steps:
86-
- name: Init
87-
uses: actions/checkout@v3
88-
- name: Install pnpm
89-
uses: pnpm/action-setup@v4.0.0
90-
- name: Setup Node
91-
uses: actions/setup-node@v3
92-
with:
93-
node-version: 18
94-
cache: "pnpm"
95-
- name: Install dependencies
96-
run: pnpm install
97-
- name: Determine version
98-
uses: ./.github/version-pr
99-
id: determine-version
100-
env:
101-
PR_NUMBER: ${{ github.event.number }}
102-
- name: Publish to npm
103-
run: |
104-
cd packages/next-auth
105-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
106-
pnpm publish --no-git-checks --access public --tag experimental
107-
env:
108-
NPM_TOKEN: ${{ secrets.NPM_TOKEN_PKG }}
109-
- name: Comment version on PR
110-
uses: NejcZdovc/comment-pr@v2
111-
with:
112-
message:
113-
"🎉 Experimental release [published 📦️ on npm](https://npmjs.com/package/next-auth/v/${{ env.VERSION }})!\n \
114-
```sh\npnpm add next-auth@${{ env.VERSION }}\n```\n \
115-
```sh\nyarn add next-auth@${{ env.VERSION }}\n```\n \
116-
```sh\nnpm i next-auth@${{ env.VERSION }}\n```"
117-
env:
118-
VERSION: ${{ steps.determine-version.outputs.version }}
119-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)