Skip to content

Commit 248889f

Browse files
committed
ci: pre-release by making a pre-release on github
1 parent 7285563 commit 248889f

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

.github/workflows/prerelease.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: Pre-release
22

33
on:
4-
push:
5-
tags:
6-
- '*-alpha.*'
7-
- '*-beta.*'
8-
- '*-rc.*'
4+
release:
5+
types: [prereleased]
96

107
jobs:
118
Prerelease:
@@ -16,8 +13,19 @@ jobs:
1613
with:
1714
fetch-depth: 0
1815

19-
- name: Extract version from tag
20-
run: echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
16+
- name: Resolve version
17+
run: |
18+
TAG="${{ github.event.release.tag_name }}"
19+
if [ -n "$TAG" ]; then
20+
echo "VERSION=$TAG" >> $GITHUB_ENV
21+
else
22+
PROP=$(grep '^version=' gradle.properties | cut -d'=' -f2)
23+
if [ -n "$PROP" ]; then
24+
echo "VERSION=$PROP" >> $GITHUB_ENV
25+
else
26+
echo "❌ Could not determine version from tag or gradle.properties" && exit 1
27+
fi
28+
fi
2129
2230
- name: Setup JDK 17
2331
uses: actions/setup-java@v5.1.0
@@ -30,7 +38,7 @@ jobs:
3038

3139
- name: Publish to MavenCentral
3240
run: |
33-
./gradlew publishToSonatype --no-daemon --max-workers 1 closeAndReleaseSonatypeStagingRepository
41+
./gradlew -Pversion=$VERSION publishToSonatype --no-daemon --max-workers 1 closeAndReleaseSonatypeStagingRepository
3442
env:
3543
STREAM_API_KEY: ${{ vars.STREAM_API_KEY }}
3644
STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }}
@@ -42,9 +50,3 @@ jobs:
4250
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
4351
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
4452

45-
- name: Create pre-release on GitHub
46-
uses: ncipollo/release-action@v1
47-
with:
48-
tag: ${{ env.VERSION }}
49-
prerelease: true
50-
token: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,7 @@ The job creates a pull request with the changelog. Check if it looks good.
120120
- Merge the pull request.
121121

122122
Once the PR is merged, it automatically kicks off another job which will upload the Gem to RubyGems.org and creates a GitHub release.
123+
124+
### Pre-releases
125+
126+
Push a tag (e.g. `1.0.0-beta.1`), then go to **GitHub Releases → Draft a new release**, select the tag, check **"Set as a pre-release"**, and publish. The CI job will trigger automatically and publish to MavenCentral.

0 commit comments

Comments
 (0)