Skip to content

Commit 336d3fa

Browse files
authored
Add automatic snapshot publishing (#6)
1 parent 755bf6e commit 336d3fa

File tree

3 files changed

+67
-20
lines changed

3 files changed

+67
-20
lines changed

.github/workflows/publish-new-version.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Publish new version
22

33
on:
44
workflow_dispatch:
@@ -12,16 +12,6 @@ on:
1212
- minor
1313
- major
1414
default: minor
15-
version-properties-file:
16-
description: 'Path to properties file containing version'
17-
required: false
18-
type: string
19-
default: 'gradle.properties'
20-
snapshot:
21-
description: 'Snapshot release'
22-
required: false
23-
type: boolean
24-
default: false
2515

2616
concurrency:
2717
group: release
@@ -34,8 +24,6 @@ jobs:
3424
uses: ./.github/workflows/release.yml
3525
with:
3626
bump: ${{ inputs.bump }}
37-
version-properties-file: ${{ inputs.version-properties-file }}
38-
snapshot: ${{ inputs.snapshot }}
3927
secrets:
4028
github-token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
4129
maven-central-username: ${{ secrets.OSSRH_USERNAME }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Snapshot builds
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: snapshot-release
11+
cancel-in-progress: false
12+
13+
jobs:
14+
release:
15+
permissions:
16+
contents: write
17+
uses: ./.github/workflows/release.yml
18+
with:
19+
bump: patch
20+
snapshot: true
21+
secrets:
22+
github-token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
23+
maven-central-username: ${{ secrets.OSSRH_USERNAME }}
24+
maven-central-password: ${{ secrets.OSSRH_PASSWORD }}
25+
signing-key: ${{ secrets.SIGNING_KEY }}
26+
signing-key-id: ${{ secrets.SIGNING_KEY_ID }}
27+
signing-key-password: ${{ secrets.SIGNING_PASSWORD }}

.github/workflows/release.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,42 @@ on:
3838
required: true
3939

4040
jobs:
41-
publish:
41+
publish-snapshot:
42+
if: ${{ inputs.snapshot }}
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
with:
49+
token: ${{ secrets.github-token }}
50+
ref: develop
51+
52+
- name: Bump version
53+
id: bump
54+
uses: GetStream/stream-build-conventions-android/.github/actions/bump-version@develop
55+
with:
56+
bump: ${{ inputs.bump }}
57+
file: ${{ inputs.version-properties-file }}
58+
59+
- name: Setup Gradle
60+
uses: GetStream/stream-build-conventions-android/.github/actions/setup-gradle@develop
61+
with:
62+
cache-read-only: false
63+
64+
- name: Build and publish snapshot
65+
run: ./gradlew publish --no-configuration-cache
66+
env:
67+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.maven-central-username }}
68+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.maven-central-password }}
69+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signing-key }}
70+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signing-key-id }}
71+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signing-key-password }}
72+
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true
73+
SNAPSHOT: true
74+
75+
publish-release:
76+
if: ${{ !inputs.snapshot }}
4277
runs-on: ubuntu-latest
4378

4479
steps:
@@ -85,15 +120,14 @@ jobs:
85120
push: false
86121

87122
- name: Push changes to ci-release branch
88-
if: ${{ !inputs.snapshot }}
89123
run: git push origin HEAD:ci-release --force-with-lease
90124

91125
- name: Setup Gradle
92126
uses: GetStream/stream-build-conventions-android/.github/actions/setup-gradle@develop
93127
with:
94128
cache-read-only: false
95129

96-
- name: Build and publish
130+
- name: Build and publish release
97131
run: ./gradlew publish --no-configuration-cache
98132
env:
99133
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.maven-central-username }}
@@ -102,11 +136,9 @@ jobs:
102136
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signing-key-id }}
103137
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signing-key-password }}
104138
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true
105-
# todo Make it a gradle property instead?
106-
SNAPSHOT: ${{ inputs.snapshot }}
139+
SNAPSHOT: false
107140

108141
- name: Create Github Release
109-
if: ${{ !inputs.snapshot }}
110142
uses: ncipollo/[email protected]
111143
with:
112144
generateReleaseNotes: true
@@ -117,7 +149,7 @@ jobs:
117149

118150
sync_branches:
119151
if: ${{ !inputs.snapshot }}
120-
needs: publish
152+
needs: publish-release
121153
name: Sync main and develop with release
122154
runs-on: ubuntu-latest
123155
steps:

0 commit comments

Comments
 (0)