|
4 | 4 |
|
5 | 5 | # This workflow will publish a Java project with Gradle |
6 | 6 | # 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 |
7 | 8 |
|
8 | 9 | name: Publish Release |
9 | 10 |
|
10 | 11 | on: workflow_dispatch |
11 | 12 |
|
12 | 13 | jobs: |
13 | | - publish-release: |
| 14 | + |
| 15 | + github: |
14 | 16 | runs-on: ubuntu-22.04 |
| 17 | + permissions: |
| 18 | + contents: write |
| 19 | + outputs: |
| 20 | + version: ${{ steps.version.outputs.version }} |
15 | 21 | steps: |
16 | 22 |
|
17 | 23 | - name: Checkout repository |
18 | | - uses: actions/checkout@v3 |
| 24 | + uses: actions/checkout@v3 # TODO: with... bot? |
19 | 25 |
|
20 | 26 | - name: Fetch git tags # Required for axion-release-plugin |
21 | | - run: git fetch --tags --unshallow |
| 27 | + run: git fetch --tags |
22 | 28 |
|
23 | 29 | - name: Set up JDK 17 |
24 | 30 | uses: actions/setup-java@v3 |
|
33 | 39 | uses: gradle/gradle-build-action@v2.7.0 |
34 | 40 |
|
35 | 41 | - 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 |
37 | 77 |
|
38 | 78 | - name: Publish to Maven Central |
39 | 79 | run: ./gradlew publish |
|
0 commit comments