Skip to content

Commit

Permalink
Merge pull request #29 from CoocooFroggy/continuous-integration
Browse files Browse the repository at this point in the history
Continuous Integration (+ README updates)
  • Loading branch information
CoocooFroggy authored Apr 12, 2021
2 parents 677049c + 1fa6257 commit ae395a0
Show file tree
Hide file tree
Showing 28 changed files with 380 additions and 1 deletion.
332 changes: 332 additions & 0 deletions .github/workflows/build-pack-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,332 @@
name: Build, Pack, Release

# Controls when the action will run.
on:
# Triggers the workflow on push but only for the master branch
pull_request:
types: [ closed ]

jobs:
build-and-create-draft:
# Only run if it was a PR merge
if: github.event.pull_request.merged == true
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Find Comment
uses: peter-evans/find-comment@v1
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: CoocooFroggy
body-includes: FutureRestore GUI — v
direction: last

- name: Parse comment
id: parse-comment
env:
COMMENT_BODY: ${{ steps.find-comment.outputs.comment-body }}
run: |
echo "Comment body is: $COMMENT_BODY"
version=$(echo "$COMMENT_BODY" | grep -Po '(?<=FutureRestore GUI — v).*')
echo "Version set to $version"
echo "::set-output name=version::$version"
echo $version > version.txt
release_body=$(echo "$COMMENT_BODY" | sed '1d')
echo "Release body set to $release_body"
echo "::set-output name=release-body::$release_body"
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Jar
run: ./gradlew shadowJar
# Upload this built jar
- name: Upload final jar
uses: actions/upload-artifact@v2
with:
name: fat-jar
path: ./build/libs/FutureRestore GUI-1.0-all.jar

- name: Upload version
uses: actions/upload-artifact@v2
with:
name: version
path: version.txt

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.parse-comment.outputs.version }}
release_name: FutureRestore GUI — v${{ steps.parse-comment.outputs.version }}
body: ${{ steps.parse-comment.outputs.release-body }}
draft: true
prerelease: false

- name: Create upload URL file
env:
UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }}
run: echo $UPLOAD_URL > upload-url.txt
- name: Upload release's upload URL
uses: actions/upload-artifact@v2
with:
name: upload-url
path: upload-url.txt

- name: Create release ID file
env:
RELEASE_ID: ${{ steps.create_release.outputs.id }}
run: echo $RELEASE_ID > release-id.txt
- name: Upload release's upload URL
uses: actions/upload-artifact@v2
with:
name: release-id
path: release-id.txt

ubuntu-pack:
needs: [ build-and-create-draft ]
runs-on: ubuntu-latest
steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Set up JDK 15
uses: actions/setup-java@v1
with:
java-version: 15

- name: Download final jar
uses: actions/download-artifact@v2
with:
name: fat-jar
path: ./input

- name: Download version
uses: actions/download-artifact@v2
with:
name: version
- name: Output version
id: output-version
run: |
version=$(tail version.txt)
echo "::set-output name=version::$version"
- name: Run JPackage deb
env:
RUN_NUMBER: ${{ github.run_number }}
VERSION: ${{ steps.output-version.outputs.version }}
run: jpackage --input ./input --name "FutureRestore GUI" --main-jar "FutureRestore GUI-1.0-all.jar" --main-class Main --type deb --icon ./.github/workflows/ubuntu/Icon-1024.png --copyright "© CoocooFroggy 2021" --verbose --name "FutureRestore GUI" --module-path ./.github/workflows/ubuntu/javafx-jmods-11.0.2 --add-modules javafx.swing,javafx.graphics,javafx.base,java.logging,java.sql,java.base,jdk.crypto.ec,java.naming --app-version $VERSION 2>&1 | tee /tmp/jpackoutput.txt
- name: Grep DEB name
id: grep_deb_name
run: |
deb_name=$(grep -Po '(?<=Package \(.deb\) saved to: ).*(?=.)' /tmp/jpackoutput.txt)
echo "::set-output name=deb_filename::$deb_name"
- name: Run JPackage app-image
env:
RUN_NUMBER: ${{ github.run_number }}
VERSION: ${{ steps.output-version.outputs.version }}
run: jpackage --input ./input --name "FutureRestore GUI" --main-jar "FutureRestore GUI-1.0-all.jar" --main-class Main --type app-image --icon ./.github/workflows/ubuntu/Icon-1024.png --copyright "© CoocooFroggy 2021" --verbose --name "FutureRestore GUI" --module-path ./.github/workflows/ubuntu/javafx-jmods-11.0.2 --add-modules javafx.swing,javafx.graphics,javafx.base,java.logging,java.sql,java.base,jdk.crypto.ec,java.naming --app-version $VERSION

- name: Zip app-image and run script
run: zip -r FutureRestore-GUI-Linux-Universal.zip "FutureRestore GUI" ./.github/workflows/ubuntu/"Run FutureRestore GUI.sh"

- name: Download URL to upload to
uses: actions/download-artifact@v2
with:
name: upload-url
# Make it usable in Github actions
- name: Set output for upload-url
id: set_upload_url
run: |
upload_url=$(tail upload-url.txt)
echo "::set-output name=upload-url::$upload_url"
- name: Upload DEB to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload-url }}
asset_path: ${{ steps.grep_deb_name.outputs.deb_filename }}
asset_name: FutureRestore-GUI-Debian-${{ steps.output-version.outputs.version }}.deb
asset_content_type: application/octet-stream

- name: Upload app-image zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload-url }}
asset_path: FutureRestore-GUI-Linux-Universal.zip
asset_name: FutureRestore-GUI-Linux-Universal-${{ steps.output-version.outputs.version }}.zip
asset_content_type: application/zip




macos-pack:
needs: [ build-and-create-draft ]
runs-on: macos-latest
steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Set up JDK 15
uses: actions/setup-java@v1
with:
java-version: 15

- name: Download final jar
uses: actions/download-artifact@v2
with:
name: fat-jar
path: ./input

- name: Download version
uses: actions/download-artifact@v2
with:
name: version
- name: Output version
id: output-version
run: |
version=$(tail version.txt)
echo "::set-output name=version::$version"
- name: Run JPackage and remove signature
env:
RUN_NUMBER: ${{ github.run_number}}
VERSION: ${{ steps.output-version.outputs.version }}
run: |
jpackage --input ./input --main-jar "FutureRestore GUI-1.0-all.jar" --main-class Main --type app-image --icon ./.github/workflows/mac/FutureRestoreGUIIcons.icns --copyright "© CoocooFroggy 2021" --verbose --mac-package-identifier com.coocoofroggy.futurerestoregui --name "FutureRestore GUI" --module-path ./.github/workflows/mac/javafx-jmods-11.0.2 --add-modules javafx.swing,javafx.graphics,javafx.base,java.logging,java.sql,java.base,jdk.crypto.ec,java.naming --app-version $VERSION
codesign --remove-signature FutureRestore\ GUI.app
- name: Zip .app
id: zip_app
run: zip -r FutureRestore-GUI-Mac.zip "FutureRestore GUI.app"

- name: Download URL to upload to
uses: actions/download-artifact@v2
with:
name: upload-url
# Make it usable in Github actions
- name: Set output for upload-url
id: set_upload_url
run: |
upload_url=$(tail upload-url.txt)
echo "::set-output name=upload-url::$upload_url"
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload-url }}
asset_path: FutureRestore-GUI-Mac.zip
asset_name: FutureRestore-GUI-Mac-${{ steps.output-version.outputs.version }}.zip
asset_content_type: application/zip

windows-pack:
needs: [ build-and-create-draft ]
runs-on: windows-latest
steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Set up JDK 15
uses: actions/setup-java@v1
with:
java-version: 15

- name: Download final jar
uses: actions/download-artifact@v2
with:
name: fat-jar
path: ./input

- name: Download version
uses: actions/download-artifact@v2
with:
name: version
- name: Output version
id: output-version
run: |
FOR /F "tokens=*" %%g IN ('tail version.txt') do (SET version=%%g)
echo ::set-output name=version::%version%
shell: cmd

- name: Run JPackage
env:
RUN_NUMBER: ${{ github.run_number }}
VERSION: ${{ steps.output-version.outputs.version }}
run: jpackage --input ./input --name "FutureRestore GUI" --main-jar "FutureRestore GUI-1.0-all.jar" --main-class Main --type msi --icon ./.github/workflows/windows/FRWindows.ico --copyright "© CoocooFroggy 2021" --verbose --name "FutureRestore GUI" --win-shortcut --win-menu --module-path ./.github/workflows/windows/javafx-jmods-11.0.2 --add-modules javafx.swing,javafx.graphics,javafx.base,java.logging,java.sql,java.base,jdk.crypto.ec,java.naming --app-version %VERSION%
shell: cmd

- name: Find MSI name
id: grep_msi_name
run: |
FOR /F "tokens=*" %%g IN ('ls *.msi') do (SET msi_name=%%g)
echo ::set-output name=msi_filename::%msi_name%
# Otherwise it tries powershell
shell: cmd

- name: Download URL to upload to
uses: actions/download-artifact@v2
with:
name: upload-url
# Make it usable in Github actions
- name: Set output for upload-url
id: set_upload_url
run: |
FOR /F "tokens=*" %%g IN ('tail upload-url.txt') do (SET upload_url=%%g)
echo ::set-output name=upload-url::%upload_url%
# Otherwise it tries powershell
shell: cmd

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload-url }}
asset_path: ${{ steps.grep_msi_name.outputs.msi_filename }}
asset_name: FutureRestore-GUI-Windows-${{ steps.output-version.outputs.version }}.msi
asset_content_type: application/octet-stream

publish-release:
needs: [ ubuntu-pack, macos-pack, windows-pack ]
runs-on: ubuntu-latest
steps:
- name: Download release ID
uses: actions/download-artifact@v2
with:
name: release-id
- name: Output release ID
id: output-release-id
run: |
release_id=$(tail release-id.txt)
echo "::set-output name=release-id::$release_id"
- name: Publish release from draft
uses: StuYarrow/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ steps.output-release-id.outputs.release-id }}
39 changes: 39 additions & 0 deletions .github/workflows/compile-java-11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This is a basic workflow to help you get started with Actions

name: ShadowJar with Java 11

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-and-upload:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Jar
run: ./gradlew shadowJar

# Upload this built jar
- name: Upload final jar
uses: actions/upload-artifact@v2
with:
name: fat-jar
path: ./build/libs/FutureRestore GUI-1.0-all.jar
Binary file added .github/workflows/mac/FutureRestoreGUIIcons.icns
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .github/workflows/ubuntu/Icon-1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions .github/workflows/ubuntu/Run FutureRestore GUI.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

FutureRestore\ GUI/bin/FutureRestore\ GUI
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .github/workflows/windows/FRWindows.ico
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,14 @@ For GUI related issues, open an issue in the GitHub [issues section](https://git

## Contributing

Cloning the repository:
#### Cloning the repository:
```
git clone https://github.com/CoocooFroggy/FutureRestore-GUI.git
```

#### Building:
Build a .jar with `gradle shadowjar`. Requires Java 11 or later.

Package to a Windows .msi, Mac .app, or Linux .deb, .rpm, app-image with JPackage from Java 14 or later (continuous integration releases use Java 15).

Pull requests are welcome. For major feature requests, please open an issue to discuss what improvements you would like to see.

0 comments on commit ae395a0

Please sign in to comment.