Replace lena #1271
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 | |
# in your browser and copy the full "upload_url" value including the {?name,label} part | |
UPLOAD_URL: https://uploads.github.com/repos/MarginallyClever/Makelangelo-software/releases/54908875/assets{?name,label} | |
RELEASE_ID: 54908875 # 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/[email protected] | |
- uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'maven' | |
# from https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
- name: Build and Test with Maven | |
timeout-minutes: 15 | |
run: ./mvnw -B test | |
- name: Package with Maven | |
run: ./mvnw -B clean package -DskipTests | |
- name: Check files 1 | |
run: ls -l src/main/package/ | |
- 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 src/main/package/thankyou.* target/universal-package/ && | |
cp CONTRIBUTING.md target/universal-package/ && | |
cp LICENSE target/universal-package/ && | |
cp README.md target/universal-package/ && | |
cp target/Makelangelo-*-with-dependencies.jar target/universal-package/ && | |
cd target/universal-package/ && | |
7z a -tzip Makelangelo.zip . && | |
mv Makelangelo.zip ../.. | |
- name: Prepare target/package for upload | |
shell: bash | |
run: | | |
mkdir -p target/package && | |
cp src/main/package/*.bat target/package/ && | |
cp src/main/package/start* target/package/ && | |
cp src/main/package/thankyou.* target/package/ && | |
cp CONTRIBUTING.md target/package/ && | |
cp LICENSE target/package/ && | |
cp README.md target/package/ | |
- name: Check files 2a | |
run: ls -l target/universal-package/ | |
- name: Check files 2b | |
run: ls -l target/package/ | |
- name: Deploy universal release | |
if: github.repository == 'MarginallyClever/Makelangelo-software' && github.ref == 'refs/heads/master' | |
uses: WebFreak001/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
release_id: ${{ env.RELEASE_ID }} | |
asset_path: Makelangelo.zip # path to archive to upload | |
asset_name: Makelangelo-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/[email protected] | |
with: | |
name: jar | |
retention-days: 1 | |
path: | | |
src/main/package/jpackage* | |
src/main/package/logo* | |
LICENSE | |
README | |
target/package/* | |
- name: Check files 3 | |
run: ls -l target/universal-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/[email protected] | |
with: | |
name: jar | |
- name: Check files 4 | |
run: ls -l target/package/ | |
- name: Build installation package | |
shell: bash | |
run: | | |
set -x | |
set -o pipefail | |
APP_VERSION=$(ls -1 target/package/Makelangelo-*-with-dependencies.jar | sed "s/.*Makelangelo-\([^-]*\)-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 "Makelangelo-$APP_VERSION-with-dependencies.jar" && | |
ls && | |
BINARY=$(find . -maxdepth 1 -iname 'makelangelo*' | grep -E '(msi$|dmg$|deb$)' | sed "s,./,," | head -1) && | |
BINARY_NIGHTLY=$(echo $BINARY | sed 's/[Mm]akelangelo\(.*\)\.\(.*\)/\Makelangelo-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/Makelangelo-software' | |
# if: github.repository == 'MarginallyClever/Makelangelo-software' && github.ref == 'refs/heads/master' | |
uses: WebFreak001/[email protected] | |
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/Makelangelo-software' || github.ref != 'refs/heads/master' | |
uses: actions/[email protected] | |
with: | |
name: ${{ env.BINARY }} | |
retention-days: 2 | |
path: ${{ env.BINARY }} |