Skip to content

Commit fe7f287

Browse files
committed
ci: implement automatic SNAPSHOT version generation for continuous deployment (#625)
- Modified early-access workflow to automatically append -SNAPSHOT to versions - Skip snapshot releases for already-released versions (with git tags) - Skip snapshot releases for RC and existing SNAPSHOT versions - Configure JReleaser to mark SNAPSHOT versions as prereleases - Enable continuous deployment for every push to main branch Fixes #625
1 parent 38e9d23 commit fe7f287

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

.github/workflows/early-access.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,29 @@ jobs:
5656
id: vars
5757
shell: bash
5858
run: |
59-
VERSION=$(grep '^version\s*=\s*' gradle.properties | cut -d'=' -f2 | xargs)
60-
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
61-
# Check if version is a SNAPSHOT or Release Candidate (early access)
62-
if [[ "$VERSION" == *-SNAPSHOT ]] || [[ "$VERSION" == *-RC* ]]; then
63-
echo "EARLY_ACCESS=true" >> "$GITHUB_OUTPUT"
59+
BASE_VERSION=$(grep '^version\s*=\s*' gradle.properties | cut -d'=' -f2 | xargs)
60+
echo "BASE_VERSION=$BASE_VERSION" >> "$GITHUB_OUTPUT"
61+
62+
# Check if current version is already a release (RC, SNAPSHOT, or tagged release)
63+
if [[ "$BASE_VERSION" == *-SNAPSHOT ]] || [[ "$BASE_VERSION" == *-RC* ]]; then
64+
echo "SHOULD_RELEASE_SNAPSHOT=false" >> "$GITHUB_OUTPUT"
65+
echo "Skipping snapshot release: version is already a pre-release ($BASE_VERSION)"
6466
else
65-
echo "EARLY_ACCESS=false" >> "$GITHUB_OUTPUT"
67+
# Check if this exact version has been released as a tag
68+
if git tag --list | grep -q "^v${BASE_VERSION}$"; then
69+
echo "SHOULD_RELEASE_SNAPSHOT=false" >> "$GITHUB_OUTPUT"
70+
echo "Skipping snapshot release: version $BASE_VERSION has already been released"
71+
else
72+
# Create snapshot version
73+
SNAPSHOT_VERSION="${BASE_VERSION}-SNAPSHOT"
74+
echo "VERSION=$SNAPSHOT_VERSION" >> "$GITHUB_OUTPUT"
75+
echo "SHOULD_RELEASE_SNAPSHOT=true" >> "$GITHUB_OUTPUT"
76+
echo "Will release snapshot version: $SNAPSHOT_VERSION"
77+
fi
6678
fi
6779
68-
- name: Release
69-
if: ${{ steps.vars.outputs.EARLY_ACCESS == 'true' }}
80+
- name: Release Snapshot
81+
if: ${{ steps.vars.outputs.SHOULD_RELEASE_SNAPSHOT == 'true' }}
7082
uses: jreleaser/release-action@v2
7183
with:
7284
arguments: release

jreleaser.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ release:
2525
sign: true
2626
prerelease:
2727
enabled: auto
28-
pattern: .*-(?:SNAPSHOT|RC\d+).*
28+
pattern: .*-SNAPSHOT.*
29+
draft: false
2930
changelog:
3031
formatted: ALWAYS
3132
preset: conventional-commits

0 commit comments

Comments
 (0)