-
Notifications
You must be signed in to change notification settings - Fork 438
117 lines (96 loc) · 3.19 KB
/
release.yml
File metadata and controls
117 lines (96 loc) · 3.19 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
name: Manual Release
on:
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g., 7.1.0)"
required: true
type: string
tag:
description: "NPM tag (latest, next, alpha, beta)"
required: true
type: choice
default: "latest"
options:
- latest
- next
- alpha
- beta
permissions:
contents: write
id-token: write
jobs:
manual-release:
name: Manual Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Update package version
run: |
npm version ${{ github.event.inputs.version }} --no-git-tag-version
echo "Updated package.json to version ${{ github.event.inputs.version }}"
- name: Build package
run: pnpm build
- name: Run TypeScript type checking
run: pnpm typecheck
- name: Run linting
run: pnpm lint
- name: Run unit tests
run: pnpm test:unit
- name: Lint example app
run: pnpm example:lint
- name: Type check example app
run: pnpm example:typecheck
- name: Build example app
run: pnpm example:build
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run E2E tests
run: pnpm test:e2e --project=chromium
env:
CI: true
- name: Publish to npm
run: |
echo "Publishing version ${{ github.event.inputs.version }} with tag '${{ github.event.inputs.tag }}'"
pnpm publish --tag ${{ github.event.inputs.tag }} --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}"
git push origin "v${{ github.event.inputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ github.event.inputs.version }}"
name: "v${{ github.event.inputs.version }}"
body: |
## Manual Release v${{ github.event.inputs.version }}
Published to npm with tag: `${{ github.event.inputs.tag }}`
Install with:
```bash
npm install next-seo@${{ github.event.inputs.tag }}
# or
pnpm add next-seo@${{ github.event.inputs.tag }}
```
prerelease: ${{ github.event.inputs.tag != 'latest' }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}