Skip to content

Commit 3f8a0ca

Browse files
chore: add release flow to actions (#5)
1 parent 049b276 commit 3f8a0ca

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

.github/workflows/build_and_test.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Build and test
22

33
on:
4-
push
4+
push:
5+
workflow_call:
56

67
jobs:
78
build:

.github/workflows/release.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release PowerSync
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number (e.g., 1.0.0 or 1.0.0-Beta.1)'
8+
required: true
9+
type: string
10+
release_notes:
11+
description: 'Release notes'
12+
required: true
13+
type: string
14+
15+
jobs:
16+
build:
17+
uses: ./.github/workflows/build_and_test.yaml
18+
release:
19+
needs: build
20+
runs-on: macos-latest
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Validate version format and set prerelease flag
29+
id: version_check
30+
run: |
31+
if [[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+(-Beta\.[0-9]+)?$ ]]; then
32+
if [[ ${{ github.event.inputs.version }} =~ -Beta\.[0-9]+$ ]]; then
33+
echo "is_prerelease=true" >> $GITHUB_OUTPUT
34+
echo "Version is valid Beta format"
35+
else
36+
echo "is_prerelease=false" >> $GITHUB_OUTPUT
37+
echo "Version is valid release format"
38+
fi
39+
else
40+
echo "Invalid version format. Must be either:"
41+
echo "- Release version: X.Y.Z (e.g., 1.0.0)"
42+
echo "- Beta version: X.Y.Z-Beta.N (e.g., 1.0.0-Beta.1)"
43+
exit 1
44+
fi
45+
46+
- name: Create Git tag
47+
run: |
48+
git tag v${{ github.event.inputs.version }}
49+
git push origin v${{ github.event.inputs.version }}
50+
51+
- name: Create GitHub Release
52+
uses: ncipollo/release-action@v1
53+
with:
54+
tag: v${{ github.event.inputs.version }}
55+
name: PowerSync v${{ github.event.inputs.version }}
56+
body: ${{ github.event.inputs.release_notes }}
57+
draft: false
58+
prerelease: ${{ steps.version_check.outputs.is_prerelease }}
59+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)