Merge branch '2.109.3' of https://github.com/MarginallyClever/Robot-O… #1146
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI with Maven | |
env: | |
# find out this value by opening `https://api.github.com/repos/<owner>/<repo>/releases`. then find the correct release. | |
# in your browser and copy the full "upload_url" value including the {?name,label} part. | |
UPLOAD_URL: https://uploads.github.com/repos/MarginallyClever/Robot-Overlord-App/releases/28206919/assets{?name,label} | |
RELEASE_ID: 28206919 # same as above (id can just be taken out the upload_url, it's used to find old releases) | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- uses: actions/setup-java@v3.9.0 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'maven' | |
- name: Build and Test with Maven | |
timeout-minutes: 15 | |
run: ./mvnw -B test | |
- name: Generate JaCoCo Badge | |
if: github.ref != 'refs/heads/master' | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
generate-branches-badge: true | |
- name: Commit and push the badge (if it changed) | |
if: github.ref != 'refs/heads/master' | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: 'commit badge' | |
add: '*.svg' | |
- name: Package with Maven | |
run: ./mvnw -B clean package -DskipTests | |
- name: Prepare universal package | |
shell: bash | |
run: | | |
mkdir -p target/universal-package && | |
cp src/main/package/*.bat target/universal-package/ && | |
cp src/main/package/start* target/universal-package/ && | |
cp CONTRIBUTING.md target/universal-package/ && | |
cp LICENSE target/universal-package/ && | |
cp README.md target/universal-package/ && | |
cp target/RobotOverlord-*-with-dependencies.jar target/universal-package/ && | |
cd target/universal-package/ && | |
7z a -tzip RobotOverlord.zip . && | |
mv RobotOverlord.zip ../.. | |
- name: prepare package for distro | |
shell: bash | |
run: | | |
mkdir -p target/package | |
cp src/main/package/*.bat target/package/ && | |
cp src/main/package/start* target/package/ && | |
cp CONTRIBUTING.md target/package/ && | |
cp LICENSE target/package/ && | |
cp README.md target/package/ | |
- name: Deploy universal release | |
if: github.repository == 'MarginallyClever/Robot-Overlord-App' && github.ref == 'refs/heads/master' | |
uses: WebFreak001/deploy-nightly@v2.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
release_id: ${{ env.RELEASE_ID }}{ | |
asset_path: RobotOverlord.zip # path to archive to upload | |
asset_name: RobotOverlord-nightly-$$.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash | |
asset_content_type: application/zip # required by GitHub API | |
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted | |
- name: Upload artifact for package | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: jar | |
retention-days: 1 | |
path: | | |
src/main/package/jpackage* | |
src/main/package/logo* | |
LICENSE | |
README | |
target/package/* | |
package: | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
steps: | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: actions/download-artifact@v3.0.2 | |
with: | |
name: jar | |
- name: Check files | |
run: ls -l target/package/ | |
- name: Build installation package | |
shell: bash | |
run: | | |
set -x | |
set -o pipefail | |
APP_VERSION=$(ls -1 target/package/RobotOverlord-*-with-dependencies.jar | sed "s/.*RobotOverlord-\([^-]*\)-with-dependencies.jar/\1/") && | |
sed -i.bak "s/\(--app-version\).*/\1 $APP_VERSION/" src/main/package/jpackage.cfg && | |
jpackage "@src/main/package/jpackage.cfg" "@src/main/package/jpackage-${{matrix.os}}.cfg" --main-jar "RobotOverlord-$APP_VERSION-with-dependencies.jar" && | |
ls && | |
BINARY=$(find . -maxdepth 1 -iname 'robotoverlord*' | grep -E '(msi$|dmg$|deb$)' | sed "s,./,," | head -1) && | |
BINARY_NIGHTLY=$(echo $BINARY | sed 's/\(.*\)\.\(.*\)/\1-nightly-$$.\2/') && | |
echo "BINARY=$BINARY" | tee -a $GITHUB_ENV && | |
echo "BINARY_NIGHTLY=$BINARY_NIGHTLY" | tee -a $GITHUB_ENV | |
- name: Deploy installation release | |
if: github.repository == 'MarginallyClever/Robot-Overlord-App' && github.ref == 'refs/heads/master' | |
uses: WebFreak001/deploy-nightly@v2.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
release_id: ${{ env.RELEASE_ID }} | |
asset_path: ${{ env.BINARY }} # path to archive to upload | |
asset_name: ${{ env.BINARY_NIGHTLY }} # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash | |
asset_content_type: application/zip # required by GitHub API | |
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted | |
- name: Upload artifact for testing purpose | |
# if: github.repository == 'MarginallyClever/Robot-Overlord-App' || github.ref != 'refs/heads/master' | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: ${{ env.BINARY }} | |
retention-days: 2 | |
path: ${{ env.BINARY }} |