Skip to content

Commit 074c6b6

Browse files
committed
Keep single workflow for release
1 parent 249a01b commit 074c6b6

File tree

2 files changed

+54
-59
lines changed

2 files changed

+54
-59
lines changed

.github/workflows/release.yml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,64 @@
11
name: Release
22

33
on:
4+
push:
5+
branches:
6+
- main
7+
48
workflow_dispatch:
59
inputs:
6-
name:
7-
description: 'Github Actions - Release'
8-
required: true
9-
default: 'Github Actions - Release'
10+
snapshot:
11+
description: 'Deploy SNAPSHOT'
12+
type: boolean
13+
default: false
14+
15+
permissions:
16+
contents: read
1017

1118
jobs:
1219

13-
Publish:
20+
deploy-snapshot:
21+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.snapshot == true)
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v6
25+
26+
- uses: actions/setup-java@v5
27+
with:
28+
distribution: 'corretto'
29+
java-version: '11'
30+
31+
- name: Grant Permission
32+
run: chmod +x ./mvnw
33+
34+
- name: Check SNAPSHOT version
35+
id: check-version
36+
run: |
37+
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
38+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
39+
if [[ "$VERSION" != *-SNAPSHOT ]]; then
40+
echo "::error::Version $VERSION is not a SNAPSHOT version"
41+
exit 1
42+
fi
43+
44+
- name: Remove old Maven Settings
45+
run: rm -f /home/runner/.m2/settings.xml
46+
47+
- name: Maven Settings
48+
uses: s4u/maven-settings-action@v4.0.0
49+
with:
50+
servers: |
51+
[{
52+
"id": "central",
53+
"username": "${{ secrets.OSSRH_USERNAME }}",
54+
"password": "${{ secrets.OSSRH_PASSWORD }}"
55+
}]
56+
57+
- name: Deploy Snapshot
58+
run: ./mvnw -B -ntp deploy -DskipTests
59+
60+
publish-release:
61+
if: github.event_name == 'workflow_dispatch' && inputs.snapshot == false
1462
runs-on: ubuntu-latest
1563
steps:
1664
- uses: actions/checkout@v6
@@ -41,7 +89,7 @@ jobs:
4189
with:
4290
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
4391
passphrase: ${{ secrets.GPG_PASSPHRASE }}
44-
92+
4593
- name: Build
4694
run: mvn -ntp -B clean verify install -DskipTests -Prelease
4795

.github/workflows/snapshot.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)