Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions .github/workflows/publish-new-version.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: Publish new version

on:
workflow_dispatch:
Expand All @@ -12,16 +12,6 @@ on:
- minor
- major
default: minor
version-properties-file:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just rely on the defaults (also, the idea is to align all SDKs to use the same mechanisms, so nobody will have to specify the version properties file).

description: 'Path to properties file containing version'
required: false
type: string
default: 'gradle.properties'
snapshot:
description: 'Snapshot release'
required: false
type: boolean
default: false

concurrency:
group: release
Expand All @@ -34,8 +24,6 @@ jobs:
uses: ./.github/workflows/release.yml
with:
bump: ${{ inputs.bump }}
version-properties-file: ${{ inputs.version-properties-file }}
snapshot: ${{ inputs.snapshot }}
secrets:
github-token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
maven-central-username: ${{ secrets.OSSRH_USERNAME }}
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Snapshot builds

on:
push:
branches:
- develop
workflow_dispatch:

concurrency:
group: snapshot-release
cancel-in-progress: false

jobs:
release:
permissions:
contents: write
uses: ./.github/workflows/release.yml
with:
bump: patch
snapshot: true
secrets:
github-token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
maven-central-username: ${{ secrets.OSSRH_USERNAME }}
maven-central-password: ${{ secrets.OSSRH_PASSWORD }}
signing-key: ${{ secrets.SIGNING_KEY }}
signing-key-id: ${{ secrets.SIGNING_KEY_ID }}
signing-key-password: ${{ secrets.SIGNING_PASSWORD }}
46 changes: 39 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,42 @@ on:
required: true

jobs:
publish:
publish-snapshot:
if: ${{ inputs.snapshot }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.github-token }}
ref: develop

- name: Bump version
id: bump
uses: GetStream/stream-build-conventions-android/.github/actions/bump-version@develop
with:
bump: ${{ inputs.bump }}
file: ${{ inputs.version-properties-file }}

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

- name: Build and publish snapshot
run: ./gradlew publish --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.maven-central-username }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.maven-central-password }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signing-key }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signing-key-id }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signing-key-password }}
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true
SNAPSHOT: true

publish-release:
if: ${{ !inputs.snapshot }}
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -85,15 +120,14 @@ jobs:
push: false

- name: Push changes to ci-release branch
if: ${{ !inputs.snapshot }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took the opportunity to completely split snapshot and final release publishing. I think it's less error prone this way, as we now have two separate jobs instead of one job with excluded steps.

I also considered splitting the workflow into two files, but discarded that approach because I find it clearer to see the publishing in one place, so you don't have to know that two workflows exist.

run: git push origin HEAD:ci-release --force-with-lease

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

- name: Build and publish
- name: Build and publish release
run: ./gradlew publish --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.maven-central-username }}
Expand All @@ -102,11 +136,9 @@ jobs:
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signing-key-id }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signing-key-password }}
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true
# todo Make it a gradle property instead?
SNAPSHOT: ${{ inputs.snapshot }}
SNAPSHOT: false

- name: Create Github Release
if: ${{ !inputs.snapshot }}
uses: ncipollo/[email protected]
with:
generateReleaseNotes: true
Expand All @@ -117,7 +149,7 @@ jobs:

sync_branches:
if: ${{ !inputs.snapshot }}
needs: publish
needs: publish-release
name: Sync main and develop with release
runs-on: ubuntu-latest
steps:
Expand Down
Loading