|
| 1 | +name: Early Access |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + |
| 7 | +env: |
| 8 | + JAVA_VERSION: '11' |
| 9 | + JAVA_DISTRO: 'zulu' |
| 10 | + |
| 11 | +jobs: |
| 12 | + precheck: |
| 13 | + if: github.repository == 'jreleaser/helloworld-java-jlink' && startsWith(github.event.head_commit.message, 'Releasing version') != true |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + VERSION: ${{ steps.vars.outputs.VERSION }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Cancel previous run |
| 22 | + |
| 23 | + with: |
| 24 | + access_token: ${{ secrets.GITHUB_TOKEN }} |
| 25 | + |
| 26 | + - name: Setup Java |
| 27 | + uses: actions/setup-java@v3 |
| 28 | + with: |
| 29 | + java-version: ${{ env.JAVA_VERSION }} |
| 30 | + distribution: ${{ env.JAVA_DISTRO }} |
| 31 | + |
| 32 | + - name: Cache local Maven repository |
| 33 | + uses: actions/cache@v3 |
| 34 | + with: |
| 35 | + path: ~/.m2/repository |
| 36 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 37 | + restore-keys: ${{ runner.os }}-maven- |
| 38 | + |
| 39 | + - name: Version |
| 40 | + id: vars |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) |
| 44 | + echo "VERSION=$(echo $VERSION)" >> $GITHUB_OUTPUT |
| 45 | +
|
| 46 | + release: |
| 47 | + needs: [ precheck ] |
| 48 | + if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT') |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - name: Checkout |
| 52 | + uses: actions/checkout@v3 |
| 53 | + with: |
| 54 | + fetch-depth: 0 |
| 55 | + |
| 56 | + - name: Setup Java |
| 57 | + uses: actions/setup-java@v3 |
| 58 | + with: |
| 59 | + java-version: ${{ env.JAVA_VERSION }} |
| 60 | + distribution: ${{ env.JAVA_DISTRO }} |
| 61 | + |
| 62 | + - name: Cache Maven |
| 63 | + uses: actions/cache@v3 |
| 64 | + with: |
| 65 | + path: ~/.m2/repository |
| 66 | + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
| 67 | + restore-keys: ${{ runner.os }}-m2 |
| 68 | + |
| 69 | + - name: Setup JDKs |
| 70 | + run: ./mvnw -ntp -B -q --file pom.xml -Pjdks |
| 71 | + |
| 72 | + - name: Build |
| 73 | + run: ./mvnw -ntp -B --file pom.xml verify |
| 74 | + |
| 75 | + - name: Assemble |
| 76 | + uses: jreleaser/release-action@v2 |
| 77 | + with: |
| 78 | + arguments: assemble |
| 79 | + env: |
| 80 | + JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} |
| 81 | + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + |
| 83 | + - name: Release |
| 84 | + uses: jreleaser/release-action@v2 |
| 85 | + with: |
| 86 | + arguments: full-release |
| 87 | + env: |
| 88 | + JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} |
| 89 | + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + |
| 91 | + - name: JReleaser output |
| 92 | + if: always() |
| 93 | + uses: actions/upload-artifact@v3 |
| 94 | + with: |
| 95 | + name: jreleaser-release |
| 96 | + path: | |
| 97 | + out/jreleaser/trace.log |
| 98 | + out/jreleaser/output.properties |
0 commit comments