Skip to content

Commit

Permalink
WIP: Test jpackage
Browse files Browse the repository at this point in the history
  • Loading branch information
artoonie committed Apr 25, 2023
1 parent f2550a3 commit 61241bf
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 41 deletions.
36 changes: 36 additions & 0 deletions .github/actions/gradle-and-sha/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run gradle command and create SHA512

inputs:
gradle-command:
required: true
type: string
intermediate-filepath:
required: true
type: string
final-filepath:
required: true
type: string

runs:
using: "composite"
steps:
- name: "Run gradle command"
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: ${{ inputs.gradle-command }}
- name: "Rename zip file"
shell: bash
run: mv ${{ inputs.intermediate-filepath }} ${{ inputs.final-filepath }}

- name: "Generate SHA512 for Linux"
shell: bash
if: runner.os == 'Linux'
run: sha512sum ${{ inputs.final-filepath }} > ${{ inputs.final-filepath }}.sha512
- name: "Generate SHA512 for Windows"
shell: bash
if: runner.os == 'Windows'
run: certutil -hashfile ${{ inputs.final-filepath }} SHA512 >> ${{ inputs.final-filepath }}.sha512
- name: "Generate SHA512 for OSX"
shell: bash
if: runner.os == 'macOS'
run: openssl dgst -sha512 > ${{ inputs.final-filepath }}.sha512
78 changes: 56 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,54 @@ on:
branches:
- 'master'
- 'develop'
- 'feature/issue-57_standalone-executable'

jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: "Create filename"
id: fn
- name: "Create base filename for all artifacts"
id: basefn
shell: bash
run: |
FILEPATH=$(echo rctab_${{ github.ref_name }}_${{ runner.os }} | sed -e 's/\//_/g')
echo "FILEPATH=$FILEPATH" >> $GITHUB_OUTPUT
# Normalize platform-specific filepaths generated by gradle
- name: "Create .zip filename"
id: zipfn
shell: bash
run: echo "FILEPATH=build/${{ steps.basefn.outputs.FILEPATH }}.zip" >> $GITHUB_OUTPUT
- name: "Get extension"
id: ext
shell: bash
run: |
if [ ${{ runner.os }} == 'Windows' ]; then
echo "EXT=.exe" >> $GITHUB_OUTPUT
elif [ ${{ runner.os }} == 'Linux' ]; then
echo "EXT=" >> $GITHUB_OUTPUT
else
echo "EXT=.dmg" >> $GITHUB_OUTPUT
fi
- name: "Get jpackage output filepath"
id: jpackagefn
shell: bash
run: echo "FILENAME=build/rctab_${{ github.ref_name }}_${{ runner.os }}.zip" >> $GITHUB_OUTPUT
run: |
if [ ${{ runner.os }} == 'Windows' ]; then
echo "FILEPATH=build/jpackage/rcv-1.0.exe" >> $GITHUB_OUTPUT
elif [ ${{ runner.os }} == 'Linux' ]; then
echo "FILEPATH=build/jpackage/rcv/bin/rcv" >> $GITHUB_OUTPUT
else
echo "FILEPATH=build/jpackage/rcv-1.0.dmg" >> $GITHUB_OUTPUT
fi
- name: "Create executable filename"
id: exefn
shell: bash
run: echo "FILEPATH=build/${{ steps.basefn.outputs.FILEPATH }}${{ steps.ext.outputs.EXT }}" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3

Expand All @@ -31,40 +67,38 @@ jobs:
- name: "Validate Gradle wrapper"
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3

- name: "Create zip with Gradle"
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: jlinkZip

- name: "Rename zip file"
run: cp build/rcv.zip ${{ steps.fn.outputs.FILENAME }}
- name: "Create zip with jlinkZip"
uses: ./.github/actions/gradle-and-sha
with:
gradle-command: jlinkZip
intermediate-filepath: build/rcv.zip
final-filepath: ${{ steps.zipfn.outputs.FILEPATH }}

- name: "Generate SHA512 for Linux"
if: runner.os == 'Linux'
run: sha512sum ${{ steps.fn.outputs.FILENAME }} > ${{ steps.fn.outputs.FILENAME }}.sha512
- name: "Generate SHA512 for Windows"
if: runner.os == 'Windows'
shell: bash
run: certutil -hashfile ${{ steps.fn.outputs.FILENAME }} SHA512 >> ${{ steps.fn.outputs.FILENAME }}.sha512
- name: "Generate SHA512 for OSX"
if: runner.os == 'macOS'
run: openssl dgst -sha512 > ${{ steps.fn.outputs.FILENAME }}.sha512
- name: "Create executable with jpackage"
uses: ./.github/actions/gradle-and-sha
with:
gradle-command: jpackage
intermediate-filepath: ${{ steps.jpackagefn.outputs.FILEPATH }}
final-filepath: ${{ steps.exefn.outputs.FILEPATH }}

- uses: actions/upload-artifact@v3
with:
name: Package
if-no-files-found: error
path: |
${{ github.workspace }}/${{ steps.fn.outputs.FILENAME }}
${{ github.workspace }}/${{ steps.fn.outputs.FILENAME }}.sha512
${{ github.workspace }}/${{ steps.zipfn.outputs.FILEPATH }}
${{ github.workspace }}/${{ steps.zipfn.outputs.FILEPATH }}.sha512
${{ github.workspace }}/${{ steps.exefn.outputs.FILEPATH }}
${{ github.workspace }}/${{ steps.exefn.outputs.FILEPATH }}.sha512
retention-days: 90

- name: "Upload binaries to release"
uses: svenstaro/upload-release-action@v2
if: ${{ github.event_name }} == 'release'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/${{ steps.fn.outputs.FILENAME }}*
file: ${{ github.workspace }}/${{ steps.zipfn.outputs.FILEPATH }}*
tag: ${{ github.ref_name }}
overwrite: true
file_glob: true
19 changes: 0 additions & 19 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit 61241bf

Please sign in to comment.