Skip to content

Commit

Permalink
ci(release): update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fhussonnois committed Sep 3, 2023
1 parent 617c9c9 commit 251ba5f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]

env:
JAVA_VERSION: '17'
JAVA_DISTRO: 'zulu'
GRAAL_VERSION: '22.3.3'
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
- name: 'Set up JDK'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
check-latest: true
cache: maven

Expand Down
29 changes: 17 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on:
required: true
description: "Create a Tag"
default: true

env:
JAVA_VERSION: '17'
JAVA_DISTRO: 'zulu'
GRAAL_VERSION: '22.3.3'
jobs:
set-release-version:
runs-on: ubuntu-latest
Expand All @@ -22,11 +25,11 @@ jobs:
with:
clean: true

- name: 'Set up JDK 17'
- name: 'Set up Java'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
check-latest: true
cache: maven

Expand Down Expand Up @@ -58,11 +61,10 @@ jobs:
if: "${{ github.event.inputs.createTag == 'true' }}"
run: |
find . -name 'pom.xml' | xargs git add
git commit -m "ci: release version ${{ RELEASE_VERSION }} 🎉"
git commit -m "ci: release version ${{ env.RELEASE_VERSION }} 🎉"
git push --atomic origin HEAD:main
HEAD=$(git rev-parse HEAD)
echo "HEAD=$HEAD" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
build-distribution:
needs: [ set-release-version ]
Expand All @@ -82,13 +84,17 @@ jobs:
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
distribution: 'graalvm'
version: ${{ env.GRAAL_VERSION }}
java-version: ${{ env.JAVA_VERSION }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Build Native Image (${{ runner.os }})'
run: |
./mvnw -ntp -B --file pom.xml -Pdist package
- name: 'Build Native Image (Linux)'
if: ${{ runner.os == 'Linux' }}
run: ./mvnw -ntp -B --file pom.xml -Pnative package

- name: 'Build Native Image (macOS, Windows)'
if: ${{ runner.os == 'macOS' }}
run: ./mvnw -ntp -B --file pom.xml -Pnative package "-DskipTests"

- name: 'Build Distribution'
run: |
Expand Down Expand Up @@ -129,7 +135,6 @@ jobs:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: 'Release with JReleaser'
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 251ba5f

Please sign in to comment.