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 2497cd4
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 28 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
44 changes: 30 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@ 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
outputs:
HEAD: ${{ steps.version.outputs.HEAD }}
RELEASE_VERSION: ${{ steps.version.outputs.RELEASE_VERSION }}
steps:
- name: 'Checkout GitHub repository'
uses: actions/checkout@v3
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 @@ -55,10 +61,11 @@ jobs:
git config --global user.name "github-actions[bot]"
- name: 'Push release version'
id: version
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
Expand All @@ -70,25 +77,29 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-latest, windows-latest ]
os: [ ubuntu-latest, macOS-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: 'Checkout GitHub repository'
uses: actions/checkout@v3
with:
ref: ${{ needs.version.outputs.HEAD }}
ref: ${{ needs.set-release-version.outputs.HEAD }}
fetch-depth: 0

clean: true
- 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)'
if: ${{ runner.os == 'macOS' }}
run: ./mvnw -ntp -B --file pom.xml -Pnative package "-DskipTests"

- name: 'Build Distribution'
run: |
Expand All @@ -111,7 +122,7 @@ jobs:
- name: 'Checkout GitHub repository'
uses: actions/checkout@v3
with:
ref: ${{ needs.version.outputs.HEAD }}
ref: ${{ needs.set-release-version.outputs.HEAD }}
fetch-depth: 0

- name: 'Download all artifacts'
Expand All @@ -130,6 +141,11 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: 'Configure Git'
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: 'Release with JReleaser'
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
31 changes: 21 additions & 10 deletions jikkou-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,27 @@
</changelog>
</github>
</release>
<distribution>
<jikkou>
<artifacts>
<artifact>
<path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-x86_64.tar.gz</path>
<transform>artifacts/{{distributionName}}-{{projectEffectiveVersion}}-linux-x86_64.tar.gz</transform>
<platform>linux-x86_64</platform>
</artifact>
<artifact>
<path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-x86_64.zip</path>
<transform>artifacts/{{distributionName}}-{{projectEffectiveVersion}}-linux-x86_64.zip</transform>
<platform>linux-x86_64</platform>
</artifact>
<artifact>
<path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-x86_64.zip</path>
<transform>artifacts/{{distributionName}}-{{projectEffectiveVersion}}-osx-x86_64.zip</transform>
<platform>osx-x86_64</platform>
</artifact>
</artifacts>
</jikkou>
</distribution>
</jreleaser>
</configuration>
</plugin>
Expand Down Expand Up @@ -443,11 +464,6 @@
</profile>
<profile>
<id>deb</id>
<activation>
<file>
<exists>${project.build.directory}/${project.build.finalName}-runner${executable-suffix}</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -499,11 +515,6 @@
</profile>
<profile>
<id>rpm</id>
<activation>
<file>
<exists>${project.build.directory}/${project.build.finalName}-runner${executable-suffix}</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
Expand Down

0 comments on commit 2497cd4

Please sign in to comment.