-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (140 loc) · 4.22 KB
/
Copy pathrelease.yml
File metadata and controls
147 lines (140 loc) · 4.22 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
name: release
on:
workflow_dispatch:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-24.04
env:
PORTREEVE_HOMEPAGE_URL: ${{ github.server_url }}/${{ github.repository }}
PORTREEVE_RELEASE_BASE_URL:
${{ github.server_url }}/${{ github.repository }}/releases/download
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- run: bun ci
- run: bun run check
- run: bun run release:build
- run: bun run release:verify -- --native
- uses: actions/upload-artifact@v7
with:
name: portreeve-release
path: dist/release
if-no-files-found: error
native-smoke:
needs: build
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15
platform: macos-arm64
- runner: macos-15-intel
platform: macos-x64
- runner: ubuntu-24.04
platform: linux-x64
- runner: ubuntu-24.04-arm
platform: linux-arm64
runs-on: ${{ matrix.runner }}
name: native-smoke (${{ matrix.platform }})
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- run: bun ci
- run: bun run check
- uses: actions/download-artifact@v8
with:
name: portreeve-release
path: dist/release
- name: Restore executable artifact modes
run: chmod 755 dist/release/portreeve-v*
- run: bun run release:verify -- --native --lifecycle
- if: startsWith(matrix.platform, 'macos-')
run: bun run release:verify -- --homebrew
release-policy:
if: startsWith(github.ref, 'refs/tags/v')
needs: native-smoke
runs-on: ubuntu-24.04
steps:
- uses: actions/setup-node@v7
with:
node-version: 22
registry-url: https://registry.npmjs.org
- uses: actions/download-artifact@v8
with:
name: portreeve-release
path: dist/release
- name: Verify tag matches manifest
run: |
version=$(jq -r .softwareVersion dist/release/manifest.json)
test "$GITHUB_REF_NAME" = "v$version"
- name: Require public repository for release distribution
run: test "$(gh api "repos/$GITHUB_REPOSITORY" --jq .visibility)" = "public"
env:
GH_TOKEN: ${{ github.token }}
- name: Require npm publishing authority
run: npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Require unpublished npm version
run: |
version=$(jq -r .softwareVersion dist/release/manifest.json)
if output=$(npm view "portreeve@$version" version --json 2>&1); then
echo "portreeve@$version is already published: $output" >&2
exit 1
fi
if ! grep -q 'E404' <<<"$output"; then
echo "$output" >&2
exit 1
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-github:
if: startsWith(github.ref, 'refs/tags/v')
needs: release-policy
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
name: portreeve-release
path: dist/release
- run:
gh release create "$GITHUB_REF_NAME" dist/release/* --verify-tag
--generate-notes
env:
GH_TOKEN: ${{ github.token }}
publish-npm:
if: startsWith(github.ref, 'refs/tags/v')
needs: release-policy
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write
steps:
- uses: actions/setup-node@v7
with:
node-version: 22
registry-url: https://registry.npmjs.org
- uses: actions/download-artifact@v8
with:
name: portreeve-release
path: dist/release
- run: npm publish dist/release/portreeve-*.tgz --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}