forked from trycompai/comp
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (59 loc) · 2.19 KB
/
release.yml
File metadata and controls
73 lines (59 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Release
on:
push:
branches:
- release
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release:
name: Release
runs-on: warp-ubuntu-latest-arm64-4x
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Get version before release
id: version_before
run: echo "version=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_OUTPUT
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
HUSKY: 0
run: bun run semantic-release
- name: Check if release was created
id: check_release
run: |
# Get the latest version after semantic-release
VERSION_AFTER=$(git describe --tags --abbrev=0 2>/dev/null || echo '')
echo "version_after=$VERSION_AFTER" >> $GITHUB_OUTPUT
# Check if version changed
if [ "${{ steps.version_before.outputs.version }}" != "$VERSION_AFTER" ] && [ ! -z "$VERSION_AFTER" ]; then
echo "release_created=true" >> $GITHUB_OUTPUT
else
echo "release_created=false" >> $GITHUB_OUTPUT
fi
- name: Merge release back to main
if: ${{ steps.check_release.outputs.release_created == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
run: |
# Configure git
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Fetch all branches to ensure we have latest
git fetch origin
# Checkout main
git checkout -B main origin/main
# Merge release branch (which now has the new release commits)
git merge --no-ff origin/release -m "chore: merge release ${{ steps.check_release.outputs.version_after }} back to main [skip ci]"
# Push to main
git push origin main