Skip to content

Commit 01482b7

Browse files
committed
ci: add a release dispatch workflow
* to allow releasing from a feature branch
1 parent dc3f769 commit 01482b7

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Release-dispatch
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
env:
8+
CI: true
9+
10+
jobs:
11+
lint:
12+
name: Lint codebase
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: labd/gh-actions-typescript/pnpm-install@main
20+
21+
- name: Lint
22+
run: pnpm lint
23+
24+
build:
25+
name: Build, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
26+
runs-on: ${{ matrix.os }}
27+
needs: lint
28+
strategy:
29+
matrix:
30+
node: ["20.x", "22.x"]
31+
os: [ubuntu-latest]
32+
33+
steps:
34+
- name: Checkout repo
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Node.js
38+
uses: labd/gh-actions-typescript/pnpm-install@main
39+
with:
40+
node-version: ${{ matrix.node }}
41+
42+
- name: Test
43+
run: pnpm run test:ci
44+
45+
- name: Build
46+
run: pnpm build
47+
48+
release:
49+
timeout-minutes: 15
50+
runs-on: ubuntu-latest
51+
needs: build
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
58+
- name: Set up Node.js
59+
uses: labd/gh-actions-typescript/pnpm-install@main
60+
61+
- name: Create and publish versions
62+
uses: changesets/action@v1
63+
with:
64+
title: "Release new version"
65+
commit: "update version"
66+
publish: pnpm publish:ci
67+
version: pnpm publish:version
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
71+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)