-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (113 loc) · 3.98 KB
/
release.yml
File metadata and controls
130 lines (113 loc) · 3.98 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major
default: 'minor'
version-properties-file:
description: 'Path to properties file containing version'
required: false
type: string
default: 'gradle.properties'
concurrency:
group: release
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
ref: develop
fetch-depth: 0
- name: Verify main is merged into develop
run: |
git fetch origin main
# Check if main is fully merged into develop (i.e., main is an ancestor of develop)
if ! git merge-base --is-ancestor origin/main HEAD; then
echo "❌ Error: main branch has commits not in develop!"
echo ""
echo "This usually means someone pushed directly into main or a previous release pushed"
echo "main but failed to push develop. You need to merge main into develop:"
echo ""
echo " git checkout develop"
echo " git merge origin/main"
echo " git push origin develop"
echo ""
echo "After fixing this, you can retry the release."
exit 1
fi
echo "✅ main is fully merged into develop"
- name: Bump version
id: bump
uses: ./.github/actions/bump-version
with:
bump: ${{ github.event.inputs.bump }}
file: ${{ github.event.inputs.version-properties-file }}
- name: Commit version file
uses: EndBug/add-and-commit@v9.1.4
with:
add: ${{ github.event.inputs.version-properties-file }}
message: "AUTOMATION: Version Bump"
default_author: github_actions
push: false
- name: Push changes to ci-release branch
run: git push origin HEAD:ci-release --force-with-lease
- name: Setup Gradle
uses: ./.github/actions/setup-gradle
with:
cache-read-only: false
- name: Build and publish
run: ./gradlew build publish --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true
- name: Create Github Release
uses: ncipollo/release-action@v1.16.0
with:
generateReleaseNotes: true
token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
tag: v${{ steps.bump.outputs.new-version }}
commit: ci-release
makeLatest: true
sync_branches:
needs: publish
name: Sync main and develop with release
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
- name: Configure git
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: Sync main with ci-release
run: |
git fetch origin ci-release
git merge --ff-only origin/ci-release
- name: Sync develop with main
run: |
git fetch origin develop
git checkout develop
git merge --no-edit main
- name: Push both branches
run: |
git push origin main
git push origin develop