Skip to content

Commit abd2c43

Browse files
add pre-release
1 parent c1c9d71 commit abd2c43

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/pre-release.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
release_type:
10+
description: "Type of release (prerelease, prepatch, patch, minor, preminor, major)"
11+
required: true
12+
default: "prerelease"
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- uses: pnpm/action-setup@v3
23+
with:
24+
version: 8
25+
26+
- name: Configure Git
27+
run: |
28+
git config user.name "${{ github.actor }}"
29+
git config user.email "${{ github.actor }}@users.noreply.github.com"
30+
31+
- name: "Setup npm for npmjs"
32+
run: |
33+
npm config set registry https://registry.npmjs.org/
34+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
35+
36+
- name: Install Protobuf Compiler
37+
run: sudo apt-get install -y protobuf-compiler
38+
39+
- name: Install dependencies
40+
run: pnpm install
41+
42+
- name: Build packages
43+
run: pnpm run build
44+
45+
- name: Tag and Publish Packages
46+
id: tag_publish
47+
run: |
48+
RELEASE_TYPE=${{ github.event_name == 'push' && 'prerelease' || github.event.inputs.release_type }}
49+
npx lerna version $RELEASE_TYPE --conventional-commits --yes --no-private --force-publish
50+
npx lerna publish from-git --yes --dist-tag next
51+
52+
- name: Get Version Tag
53+
id: get_tag
54+
run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
55+
56+
- name: Generate Release Body
57+
id: release_body
58+
run: |
59+
if [ -f CHANGELOG.md ]; then
60+
echo "body=$(cat CHANGELOG.md)" >> $GITHUB_OUTPUT
61+
else
62+
echo "body=No changelog provided for this release." >> $GITHUB_OUTPUT
63+
fi
64+
65+
- name: Create GitHub Release
66+
uses: actions/create-release@v1
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
69+
PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
70+
with:
71+
tag_name: ${{ steps.get_tag.outputs.TAG }}
72+
release_name: Release
73+
body_path: CHANGELOG.md
74+
draft: false
75+
prerelease: ${{ github.event_name == 'push' }}

0 commit comments

Comments
 (0)