Skip to content

Commit fc1d727

Browse files
committed
chore(ci): add a release workflow
1 parent 297a2b0 commit fc1d727

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release on tag
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- uses: pnpm/action-setup@v2
21+
- uses: actions/setup-node@v3
22+
with:
23+
cache: pnpm
24+
node-version-file: .nvmrc
25+
registry-url: "https://registry.npmjs.org"
26+
- run: pnpm install --frozen-lockfile --prefer-offline
27+
- run: sudo apt-get install -y valgrind
28+
29+
- name: Build the libraries
30+
run: pnpm moon run :build
31+
32+
- name: Publish the libraries
33+
run: pnpm publish -r --access=public --no-git-checks
34+
env:
35+
NPM_CONFIG_PROVENANCE: true
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
38+
- name: Create a draft release
39+
run: |
40+
NEW_VERSION=$(pnpm lerna list --json | jq -r '.[] | select(.name == "@codspeed/core") | .version')
41+
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

scripts/release.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# Usage: ./scripts/release.sh <major|minor|patch>
33
set -ex
44

5+
# Fail if not on main
6+
if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then
7+
echo "Not on default branch"
8+
exit 1
9+
fi
10+
511
if [ $# -ne 1 ]; then
612
echo "Usage: ./release.sh <major|minor|patch>"
713
exit 1
@@ -10,8 +16,4 @@ fi
1016
# Fail if there are any unstaged changes left
1117
git diff --exit-code
1218

13-
pnpm lerna version $1 -y --force-publish --no-private
14-
pnpm moon run :build
15-
pnpm publish -r --access=public
16-
NEW_VERSION=$(pnpm lerna list --json | jq -r '.[] | select(.name == "@codspeed/core") | .version')
17-
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d
19+
pnpm lerna version $1 --force-publish --no-private

0 commit comments

Comments
 (0)