Skip to content

Commit 56e2530

Browse files
Merge pull request #30 from SLNE-Development/ci/add-dev-branch-handling
chore: update publish workflow to support pre/development branch handling
2 parents a7ae28c + 64ab7ef commit 56e2530

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- 'version/*'
7+
- 'pre/development'
78
workflow_dispatch:
89

910
env:
@@ -44,8 +45,8 @@ jobs:
4445

4546
- name: Build all modules with Gradle
4647
run: ./gradlew build shadowJar --parallel --no-scan
47-
4848
- name: Publish all modules to Maven
49+
if: github.ref != 'refs/heads/pre/development'
4950
run: ./gradlew publish --parallel --no-scan
5051

5152
- name: Extract Project Version and Snapshot Flag from Gradle
@@ -66,17 +67,21 @@ jobs:
6667
- name: Determine release flags
6768
run: |
6869
CURRENT_BRANCH=${GITHUB_REF#refs/heads/}
69-
# prerelease only for snapshots
70-
if [ "${SNAPSHOT_FLAG}" = "true" ]; then
70+
71+
if [ "$CURRENT_BRANCH" = "pre/development" ]; then
7172
echo "PRERELEASE=true" >> $GITHUB_ENV
72-
else
73-
echo "PRERELEASE=false" >> $GITHUB_ENV
74-
fi
75-
# make_latest false for snapshots or non-default branches
76-
if [ "${SNAPSHOT_FLAG}" = "true" ] || [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then
7773
echo "MAKE_LATEST=false" >> $GITHUB_ENV
7874
else
79-
echo "MAKE_LATEST=true" >> $GITHUB_ENV
75+
if [ "${SNAPSHOT_FLAG}" = "true" ]; then
76+
echo "PRERELEASE=true" >> $GITHUB_ENV
77+
else
78+
echo "PRERELEASE=false" >> $GITHUB_ENV
79+
fi
80+
if [ "${SNAPSHOT_FLAG}" = "true" ] || [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then
81+
echo "MAKE_LATEST=false" >> $GITHUB_ENV
82+
else
83+
echo "MAKE_LATEST=true" >> $GITHUB_ENV
84+
fi
8085
fi
8186
8287
- name: Find and filter JAR files
@@ -99,4 +104,4 @@ jobs:
99104
files: ${{ env.JAR_FILES }}
100105
generate_release_notes: true
101106
env:
102-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)