Skip to content

Commit

Permalink
update ci build
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Dec 4, 2023
1 parent de676e6 commit 66875c0
Showing 1 changed file with 24 additions and 55 deletions.
79 changes: 24 additions & 55 deletions .github/workflows/buildArtifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:

env:
APP_NAME: helloJavaFX
BUILD_VERSION: SNAPSHOT

jobs:
build:
Expand All @@ -16,34 +17,28 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
outputs:
artifact-version: SNAPSHOT #${{ steps.setversion.outputs.version }}
env:
BUILD_VERSION: SNAPSHOT
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 15
- uses: actions/cache@v2
uses: actions/setup-java@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: If tag is set, use it as version
run: echo "BUILD_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
shell: bash
if: startsWith(github.ref, 'refs/tags/')
- name: Ensure to use tagged version in maven
run: mvn versions:set --file pom.xml -DnewVersion=${{ env.BUILD_VERSION }}
distribution: zulu
java-version: 21
java-package: jdk+fx
cache: maven
- name: Ensure to use tagged version in build
shell: bash
if: startsWith(github.ref,'refs/tags/')
run: |
VERSION=${GITHUB_REF##*/}
mvn versions:set --file pom.xml -DnewVersion=${VERSION}
echo "BUILD_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Build runnable app with Maven
run: mvn -B install --file pom.xml
- name: Uploads the zip for possible further use
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_NAME }}-SNAPSHOT-${{ runner.os }}
name: ${{ env.APP_NAME }}-${{ env.BUILD_VERSION}}-${{ runner.os }}
path: target/helloJavaFX-*.[zt]*

release:
Expand All @@ -54,46 +49,20 @@ jobs:
env:
BUILD_VERSION: DUMMY
steps:
- name: Get version from tag and set up environment
run: echo "BUILD_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- name: Create a release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
:construction: Work in Progress
draft: true
prerelease: false
- name: Upload linux package to GitHub Releases
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.APP_NAME }}-SNAPSHOT-Linux/helloJavaFX-${{ env.BUILD_VERSION }}-linux.tar.gz
asset_name: ${{ env.APP_NAME }}-${{ env.BUILD_VERSION }}-linux.tar.gz
asset_content_type: application/gzip
- name: Upload mac kit to GitHub Releases
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.APP_NAME }}-SNAPSHOT-macOS/helloJavaFX-${{ env.BUILD_VERSION }}-mac.zip
asset_name: ${{ env.APP_NAME }}-${{ env.BUILD_VERSION }}-mac.zip
asset_content_type: application/zip
- name: Upload windows kit to GitHub Releases
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.APP_NAME }}-SNAPSHOT-Windows/helloJavaFX-${{ env.BUILD_VERSION }}-win.zip
asset_name: ${{ env.APP_NAME }}-${{ env.BUILD_VERSION }}-win.zip
asset_content_type: application/zip
files: |
${{ env.APP_NAME }}-SNAPSHOT-Linux/helloJavaFX-${{ env.BUILD_VERSION }}-linux.tar.gz
${{ env.APP_NAME }}-SNAPSHOT-macOS/helloJavaFX-${{ env.BUILD_VERSION }}-mac.zip
${{ env.APP_NAME }}-SNAPSHOT-Windows/helloJavaFX-${{ env.BUILD_VERSION }}-win.zip

0 comments on commit 66875c0

Please sign in to comment.