Skip to content

Commit 095cbfe

Browse files
Heiko KieselWeltraumschaf
authored andcommitted
Split release workflow into two jobs
Signed-off-by: Heiko Kiesel <heiko.kiesel@iteratec.com>
1 parent bf81186 commit 095cbfe

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,27 @@
44

55
# This workflow will publish a Java project with Gradle
66
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-gradle
7+
# Inspired by https://github.com/dzikoysk/reposilite/blob/main/.github/workflows/publish-release.yml
78

89
name: Publish Release
910

1011
on: workflow_dispatch
1112

1213
jobs:
13-
publish-release:
14+
15+
github:
1416
runs-on: ubuntu-22.04
17+
permissions:
18+
contents: write
19+
outputs:
20+
version: ${{ steps.version.outputs.version }}
1521
steps:
1622

1723
- name: Checkout repository
18-
uses: actions/checkout@v3
24+
uses: actions/checkout@v3 # TODO: with... bot?
1925

2026
- name: Fetch git tags # Required for axion-release-plugin
21-
run: git fetch --tags --unshallow
27+
run: git fetch --tags
2228

2329
- name: Set up JDK 17
2430
uses: actions/setup-java@v3
@@ -33,7 +39,41 @@ jobs:
3339
uses: gradle/gradle-build-action@v2.7.0
3440

3541
- name: Release new version
36-
run: ./gradlew release
42+
run: |
43+
git config user.name 'github-actions[bot]'
44+
git config user.email 'github-actions[bot]@users.noreply.github.com'
45+
./gradlew release
46+
47+
- name: Get current version
48+
id: version
49+
run: echo "::set-output name=version::$(./gradlew -q -Prelease.quiet currentVersion)"
50+
51+
# TODO: Create Github release
52+
53+
maven:
54+
runs-on: ubuntu-22.04
55+
needs: [ github ]
56+
steps:
57+
58+
- name: Checkout repository
59+
uses: actions/checkout@v3
60+
with:
61+
ref: refs/tags/${{ needs.github.outputs.version }}
62+
63+
- name: Fetch git tags # Required for axion-release-plugin
64+
run: git fetch --tags
65+
66+
- name: Set up JDK 17
67+
uses: actions/setup-java@v3
68+
with:
69+
java-version: 17
70+
distribution: adopt
71+
72+
- name: Validate Gradle wrapper
73+
uses: gradle/wrapper-validation-action@v1.1.0
74+
75+
- name: Setup Gradle
76+
uses: gradle/gradle-build-action@v2.7.0
3777

3878
- name: Publish to Maven Central
3979
run: ./gradlew publish

0 commit comments

Comments
 (0)