Repository navigation
142 lines (136 loc) · 4.08 KB
/
Copy pathci.yml
File metadata and controls
142 lines (136 loc) · 4.08 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
name: CI
permissions:
contents: read
defaults:
run:
shell: bash
on:
workflow_dispatch:
push:
branches:
- main
- "v*-dev"
tags:
- "v*"
paths-ignore:
- "docs/**"
- "**.md"
- "**.png"
- "**.svg"
pull_request:
branches:
- main
- "v*-dev"
paths-ignore:
- "docs/**"
- "**.md"
- "**.png"
- "**.svg"
jobs:
verify:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '26'
cache: 'npm'
- name: Install dependencies
run: npm ci --ignore-scripts --no-audit --no-fund --prefer-offline
- name: Build
run: npm run build
- name: Typecheck, lint, and docs check
run: |
./node_modules/.bin/tsc -p tsconfig.test.json --noEmit &
PID_TYPECHECK=$!
./node_modules/.bin/eslint . &
PID_LINT=$!
node scripts/check-docs.mjs &
PID_DOCS=$!
wait "${PID_TYPECHECK}"
wait "${PID_LINT}"
wait "${PID_DOCS}"
- name: Verify closure matrix and failure scenarios
run: node packages/cli/dist/main.js closure --verify-failures
- name: Package release bundle
if: startsWith(github.ref, 'refs/tags/v')
run: |
mkdir -p dist-release
node scripts/pack-npm.mjs --version "${GITHUB_REF_NAME#v}" --out-dir dist-release
BUNDLE="dist-release/loopwright-${GITHUB_REF_NAME}.tar.gz"
tar -czf "${BUNDLE}" \
action.yml \
LICENSE \
README.md \
package.json \
package-lock.json \
packages/*/package.json \
packages/*/dist
sha256sum "${BUNDLE}" > "${BUNDLE}.sha256"
- name: Upload release bundle
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: release-bundle
path: dist-release/*
release:
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'gpustack/loopwright'
needs:
- verify
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download release bundle
uses: actions/download-artifact@v4
with:
name: release-bundle
path: dist-release
- name: Stage draft release
uses: softprops/action-gh-release@v2
with:
files: dist-release/*
draft: true
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-alpha') || contains(github.ref, '-beta') }}
generate_release_notes: true
publish-npm:
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'gpustack/loopwright'
needs:
- verify
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '26'
- name: Ensure npm supports Trusted Publishers (>= 11.5.1)
run: npm install -g npm@latest
- name: Download release bundle
uses: actions/download-artifact@v4
with:
name: release-bundle
path: dist-release
# Idempotent passwordless publish via npm Trusted Publishers (OIDC id-token: write).
- name: Publish @gpustack/loopwright to npmjs.com
run: |
VERSION="${GITHUB_REF_NAME#v}"
if npm view "@gpustack/loopwright@${VERSION}" version --prefer-online >/dev/null 2>&1; then
echo "@gpustack/loopwright@${VERSION} is already published; nothing to do."
exit 0
fi
if [[ "${GITHUB_REF_NAME}" == *-* ]]; then
DIST_TAG="next"
else
DIST_TAG="latest"
fi
npm publish "./dist-release/gpustack-loopwright-${VERSION}.tgz" --provenance --access public --ignore-scripts --tag "${DIST_TAG}"