Skip to content

Commit d307c35

Browse files
Berend Sliedrechtberendsliedrecht
authored andcommitted
build(ci): setup release CI
Signed-off-by: Berend Sliedrecht <[email protected]>
1 parent 7bd35a3 commit d307c35

File tree

2 files changed

+43
-19
lines changed

2 files changed

+43
-19
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ on:
99
branches: [main]
1010
pull_request:
1111
branches: [main]
12+
workflow_dispatch:
13+
inputs:
14+
release-type:
15+
description: 'Type of release (major, minor, patch, alpha)'
16+
required: true
17+
default: patch
18+
type: choice
19+
options:
20+
- major
21+
- minor
22+
- patch
23+
- alpha
1224

1325
jobs:
1426
continous-integration:
@@ -64,22 +76,34 @@ jobs:
6476
- name: Build library
6577
run: pnpm build
6678

67-
- name: Set NPM config
68-
if: |
69-
github.event_name == 'release' ||
70-
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-javascript-wrapper == 'true')
71-
run: |
72-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
73-
echo "registry=https://registry.npmjs.org/" >> .npmrc
74-
echo "always-auth=true" >> .npmrc
75-
76-
- name: Publish JavaScript Wrapper
77-
if: |
78-
github.event_name == 'release' ||
79-
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-javascript-wrapper == 'true')
79+
- name: Set the NPM config
80+
env:
81+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
82+
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
83+
84+
- name: Publish
85+
id: publish
86+
env:
87+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
88+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8089
run: |
81-
if [[ $(cat lerna.json | grep version | head -1 | grep dev) ]]; then
82-
npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version --dist-tag=alpha
83-
else
84-
npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version
85-
fi
90+
echo ${{ inputs.release-type }}
91+
git config --global user.name "Openwallet Foundation"
92+
93+
if [ ${{ inputs.release-type }} == 'alpha' ]; then
94+
pnpm release --pre-dist-tag alpha prerelease --yes
95+
else
96+
pnpm release ${{ inputs.release-type }} --force-publish --no-private --yes
97+
fi
98+
99+
version=$(node -p "require('./lerna.json').version")
100+
echo "LERNA_VERSION=$version" >> "$GITHUB_OUTPUT"
101+
102+
- name: Create Github Release
103+
uses: softprops/action-gh-release@v1
104+
with:
105+
generate_release_notes: true
106+
prerelease: ${{ inputs.release-type == 'alpha' }}
107+
token: ${{ secrets.GH_TOKEN }}
108+
tag_name: v${{ steps.publish.outputs.LERNA_VERSION }}
109+
name: Release v${{ steps.publish.outputs.LERNA_VERSION }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"build": "pnpm -r build",
1717
"clean": "pnpm -r clean",
1818
"test": "node --import tsx --test packages/**/tests/*.test.ts",
19-
"set-version": "npx lerna version --exact --no-git-tag-version --no-push --yes"
19+
"publish": "lerna publish"
2020
},
2121
"devDependencies": {
2222
"@biomejs/biome": "1.9.4",

0 commit comments

Comments
 (0)