From 6d89dbab900c6ee8c89df3698d0eb0543c136f96 Mon Sep 17 00:00:00 2001 From: RoiArthurB Date: Thu, 22 Feb 2024 03:30:07 +0700 Subject: [PATCH] [GHA] Refactored every worflow files Did split them in small file easier to navigate in and develop per task Naming is --.yml - If the worflow is triggerable (manually or automatically), it'll be called , else - parentMainWorflowStep without subID are generally used to organise steps on named step --- .github/workflows/publish-to-third-party.yml | 189 ------------------ ...-build-test.yml => travis-build-test.yaml} | 0 .../{gama-build.yml => travis-build.yaml} | 5 +- .github/workflows/travis-packaging-jdk.yaml | 93 +++++++++ .../travis-packaging-linux-test.yaml | 38 ++++ .github/workflows/travis-packaging-linux.yaml | 60 ++++++ .../travis-packaging-macos-test.yaml | 37 ++++ .github/workflows/travis-packaging-macos.yaml | 137 +++++++++++++ .../workflows/travis-packaging-windows.yaml | 43 ++++ .github/workflows/travis-packaging.yaml | 105 ++++++++++ .github/workflows/travis-publish-github.yaml | 152 ++++++++++++++ ...ty.yml => travis-publish-third-party.yaml} | 12 -- .github/workflows/travis-publish.yaml | 37 ++++ ...ub-travis.yml => trigger-compilation.yaml} | 10 +- ...ion.yaml => trigger-doc-regeneration.yaml} | 0 .github/workflows/trigger-gama-release.yaml | 103 ++++++++++ travis/zip_withjdk.sh | 101 ++++------ 17 files changed, 857 insertions(+), 265 deletions(-) delete mode 100644 .github/workflows/publish-to-third-party.yml rename .github/workflows/{gama-build-test.yml => travis-build-test.yaml} (100%) rename .github/workflows/{gama-build.yml => travis-build.yaml} (99%) create mode 100644 .github/workflows/travis-packaging-jdk.yaml create mode 100644 .github/workflows/travis-packaging-linux-test.yaml create mode 100644 .github/workflows/travis-packaging-linux.yaml create mode 100644 .github/workflows/travis-packaging-macos-test.yaml create mode 100644 .github/workflows/travis-packaging-macos.yaml create mode 100644 .github/workflows/travis-packaging-windows.yaml create mode 100644 .github/workflows/travis-packaging.yaml create mode 100644 .github/workflows/travis-publish-github.yaml rename .github/workflows/{custom/publish-to-third-party.yml => travis-publish-third-party.yaml} (95%) create mode 100644 .github/workflows/travis-publish.yaml rename .github/workflows/{github-travis.yml => trigger-compilation.yaml} (75%) rename .github/workflows/{weekly-doc-regeneration.yaml => trigger-doc-regeneration.yaml} (100%) create mode 100644 .github/workflows/trigger-gama-release.yaml diff --git a/.github/workflows/publish-to-third-party.yml b/.github/workflows/publish-to-third-party.yml deleted file mode 100644 index 3befdbee38..0000000000 --- a/.github/workflows/publish-to-third-party.yml +++ /dev/null @@ -1,189 +0,0 @@ -name: Auto publish release to external stores - -on: - workflow_call: - inputs: - tag: - description: "The tag of the release to publish" - type: string - required: true - default: 1.9.3 - targets: - description: "The targets to publish to separated by spaces" - type: string - default: "windows linux mac docker" - secrets: - BOT_TOKEN: - required: true - description: "The token used to authenticate to the Github API" - - workflow_dispatch: - inputs: - tag: - description: "The tag of the release to publish" - type: string - required: true - default: 1.9.3 - targets: - description: "The targets to publish to separated by spaces" - type: string - default: "windows linux mac docker" - - -run-name: Auto publishing ${{ inputs.tag }} to external stores - -jobs: - get-tag-info: - runs-on: ubuntu-latest - name: Get tag info 🏷️ - - outputs: - tag: ${{ steps.release_data.outputs.tag_name }} - prerelease: ${{ steps.release_data.outputs.prerelease }} - commit_hash: ${{ steps.tag_data.outputs.commit_hash }} - - steps: - - uses: actions/checkout@v4 - with: - fetch-tags: true - ref: ${{ inputs.tag }} - - - - name: Get tag data - id: tag_data - run: | - echo "commit_hash=$(git rev-parse --short=7 HEAD)" >> "$GITHUB_OUTPUT" - - - name: Get release data - uses: cardinalby/git-get-release-action@1.2.4 - id: release_data - env: - GITHUB_TOKEN: ${{ github.token }} - with: - tag: ${{ inputs.tag }} - - windows: - needs: get-tag-info - runs-on: ubuntu-latest - name: Publish to windows 🪟 - if: contains(inputs.targets, 'windows') - - steps: - - name: Get Previous Release info - # This version incementation shall be removed when winget-releaser will be able to delete older releases again cf. https://github.com/gama-platform/gama/issues/3917 - if: needs.get-tag-info.outputs.prerelease == 'true' - id: get-prev-release - run: | - curl -L -G \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests/g/GamaPlatform/GamaAlpha" > ${{ runner.temp }}/prev_release.json - - new_version_counter="$(jq -r '.[] | select(.type == "dir") | select(.name | test("^${{ inputs.tag }}-[0-9]+$")) | .name' ${{ runner.temp }}/prev_release.json | cut -d '-' -f 2 | sort -nuz | head -n1)" - if [ -n "$new_version_counter" ]; then - new_version_counter=$(($new_version_counter + 1)) - else - new_version_counter=1 - fi - echo "new_version_counter=$new_version_counter" >> $GITHUB_OUTPUT - - - name: Publish Gama to Winget 🚀 - if: needs.get-tag-info.outputs.prerelease == 'false' - uses: vedantmgoyal2009/winget-releaser@v2 - with: - identifier: GamaPlatform.Gama - version: ${{ inputs.tag }} - release-tag: ${{ inputs.tag }} - installers-regex: ^GAMA.+JDK.*\.exe$ - token: ${{ secrets.BOT_TOKEN }} - fork-user: gama-platform - - - name: Publish Pre release to Winget 👷 - if: needs.get-tag-info.outputs.prerelease == 'true' - uses: vedantmgoyal2009/winget-releaser@v2 - with: - identifier: GamaPlatform.GamaAlpha - version: ${{ inputs.tag }}-${{ steps.get-prev-release.outputs.new_version_counter }} - release-tag: ${{ inputs.tag }} - installers-regex: ^GAMA.+JDK.*\.exe$ - token: ${{ secrets.BOT_TOKEN }} - max-versions-to-keep: 1 - fork-user: gama-platform - - - name: Get PR created for the release - id: get-pr - run: | - curl -G \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - --data-urlencode "q=is:pr author:gama-bot state:open repo:microsoft/winget-pkgs sort:created-desc" \ - "https://api.github.com/search/issues?sort=created&order=desc&per_page=1" > ${{ runner.temp }}/pr.json - - echo "number=$(jq -r '.items[0].number' ${{ runner.temp }}/pr.json)" >> $GITHUB_OUTPUT - - - name: Mention developpers - uses: actions/github-script@v3 - with: - github-token: ${{secrets.BOT_TOKEN}} - script: | - let is_pre_release = ${{ needs.get-tag-info.outputs.prerelease }} == 'true' - - github.issues.createComment({ - issue_number: ${{ steps.get-pr.outputs.number }}, - owner: "microsoft", - repo: "winget-pkgs", - body: 'Poke :point_right: @${{ github.triggering_actor }} @WoodenMaiden @lesquoyb' - }) - - core.summary. - addHeading( - `Release ${{ inputs.tag }}${(is_pre_release)? "" : "-${{ steps.get-prev-release.outputs.new_version_counter }} alpha (with hash ${{needs.get-tag-info.outputs.commit_hash }})" } published to Winget 🚀` - ) - .addLink("Link to the Winget PR", "https://github.com/microsoft/winget-pkgs/pull/${{ steps.get-pr.outputs.number }}") - .write() - - - docker: - needs: get-tag-info - runs-on: ubuntu-latest - name: Publish pre-release as container 🐳 - if: needs.get-tag-info.outputs.prerelease == 'true' && contains(inputs.targets, 'docker') - - steps: - - name: Publish Gama to Github Packages 🚀 - run: | - curl --request POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token ${{ secrets.BOT_TOKEN }}" \ - --data '{"event_type": "automated-generation"}' \ - https://api.github.com/repos/gama-platform/gama.docker/dispatches - - - linux-debian: - needs: get-tag-info - runs-on: ubuntu-latest - name: Publish to PPA/Debian repo 🐧 🟠🔴 - if: contains(inputs.targets, 'linux') - - steps: - - name: Publish Gama to https://ppa.gama-platform.org 🚀 - run: | - curl -L --fail-with-body \ - --request POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token ${{ secrets.BOT_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - --data '{"ref": "main", "inputs": {"tag": "${{ inputs.tag }}"}}' \ - https://api.github.com/repos/gama-platform/gama.ppa/actions/workflows/69865833/dispatches - - - # linux-arch: - # needs: get-tag-info - # runs-on: ubuntu-latest - # name: Publish to AUR 🐧 🔷 - - # macos: - # needs: get-tag-info - # runs-on: ubuntu-latest - # name: Publish to macos 🍎 diff --git a/.github/workflows/gama-build-test.yml b/.github/workflows/travis-build-test.yaml similarity index 100% rename from .github/workflows/gama-build-test.yml rename to .github/workflows/travis-build-test.yaml diff --git a/.github/workflows/gama-build.yml b/.github/workflows/travis-build.yaml similarity index 99% rename from .github/workflows/gama-build.yml rename to .github/workflows/travis-build.yaml index dc7539304a..8eba412c24 100644 --- a/.github/workflows/gama-build.yml +++ b/.github/workflows/travis-build.yaml @@ -69,15 +69,12 @@ jobs: env: GAMA_KEYSTORE_BASE64: ${{ secrets.GAMA_KEYSTORE_BASE64 }} GAMA_STORE: ${{ secrets.GAMA_KEYSTORE_STOREPASS }} - + - name: Tag release version if: "${{ inputs.get_all_archives_for_release }}" run: | echo "Rename mvn config file" echo "Tag latest commit with release" - - - # # ██████╗ ██╗ ██╗██╗██╗ ██████╗ ██╗███╗ ██╗ ██████╗ diff --git a/.github/workflows/travis-packaging-jdk.yaml b/.github/workflows/travis-packaging-jdk.yaml new file mode 100644 index 0000000000..263ae0d57f --- /dev/null +++ b/.github/workflows/travis-packaging-jdk.yaml @@ -0,0 +1,93 @@ +name: Testing Maven Build + +on: + workflow_call: + inputs: + RELEASE_VERSION: + required: true + default: 2024.03.0 + type: string + secrets: + GAMA_KEYSTORE_BASE64: + required: true + GAMA_KEYSTORE_STOREPASS: + required: true + +jobs: + add-jdk: + runs-on: ubuntu-latest + steps: + + - name: Get linux testing releases + uses: actions/download-artifact@v4 + with: + name: gama-compiled-archive + + - name: Get linux testing releases + uses: actions/download-artifact@v4 + with: + name: travis-scripts + path: ${{ github.workspace }}/travis + + - name: Convert maven tarball to zip archives + shell: bash + run: | + # Convert to zip archives + find . -name "gama.application-*.tar.gz" -print -exec bash -c 'tar xzf {} && zip -9 -r -q $(basename \{} .tar.gz).zip $(tar --exclude="*/*" -tf {}) && rm -fr $(tar tf {}) {} && echo "Compressed and convert {} to zip"' \; + + - name: Make zip file + shell: bash + run: | + touch $GITHUB_WORKSPACE/sign.maven + echo "$GAMA_KEYSTORE_BASE64" | base64 --decode > ~/gama.keystore + $GITHUB_WORKSPACE/travis/zip_withjdk.sh + env: + GAMA_KEYSTORE_BASE64: ${{ secrets.GAMA_KEYSTORE_BASE64 }} + GAMA_KEYSTORE_STOREPASS: ${{ secrets.GAMA_KEYSTORE_STOREPASS }} + RUNNER_TMP: ${{ runner.temp }} + + # cf https://github.com/actions/upload-artifact/issues/246 + - name: Move artefacts to root tree + run: | + # MacOS Family + mv ${{ github.workspace }}/travis/mac-sign.sh ${{ github.workspace }} + mv ${{ github.workspace }}/travis/what2sign.sh ${{ github.workspace }} + mv ${{ github.workspace }}/travis/extraresources/entitlements.plist ${{ github.workspace }} + # Windows Family + mv ${{ github.workspace }}/travis/extraresources/installer/windows/* ${{ github.workspace }} + # Debian Family + mv gama.application-linux.gtk.x86_64.zip gama-platform_${{ inputs.RELEASE_VERSION }}-1_amd64.zip + mv gama.application-linux.gtk.x86_64_withJDK.zip gama-platform-jdk_${{ inputs.RELEASE_VERSION }}-1_amd64.zip + cd ${{ github.workspace }}/travis/extraresources/installer/unix && zip -r ${{ github.workspace }}/extraresources-unix.zip . + + - uses: actions/upload-artifact@v4 + with: + name: gama-mac-unsigned + path: | + ./gama.application-macosx*zip + ./mac-sign.sh + ./what2sign.sh + ./entitlements.plist + + - uses: actions/upload-artifact@v4 + with: + name: gama-linux + path: | + ./gama-platform*amd64.zip + ./extraresources-unix.zip + + - uses: actions/upload-artifact@v4 + with: + name: gama-windows + path: | + ./gama.application-win32*zip + ./icon256.ico + ./windows_installer_script.iss + ./LICENSE + + - uses: actions/upload-artifact@v4 + with: + name: gama-zip-builds + path: | + ./gama.application-win32*zip + ./gama-platform*amd64.zip \ No newline at end of file diff --git a/.github/workflows/travis-packaging-linux-test.yaml b/.github/workflows/travis-packaging-linux-test.yaml new file mode 100644 index 0000000000..a872bf0f66 --- /dev/null +++ b/.github/workflows/travis-packaging-linux-test.yaml @@ -0,0 +1,38 @@ +name: Testing linux package + +on: + workflow_call: + inputs: + RELEASE_VERSION: + required: true + default: 2024.03.0 + type: string + +jobs: + debian-test-installer: + runs-on: ubuntu-latest + steps: + # Get Linux deb archive + - uses: actions/download-artifact@v4 + with: + name: gama-linux-deb + + - name: Update apt databse + run: | + sudo apt update + + - name: Install, Run & Remove (w JDK) + shell: bash + run: | + sudo apt install ./gama-platform-jdk_${{ inputs.RELEASE_VERSION }}-1_amd64.deb + gama-headless -help + + - name: Install, Run & Remove (w/o JDK) + shell: bash + run: | + sudo apt install -y ./gama-platform_${{ inputs.RELEASE_VERSION }}-1_amd64.deb + # Switch to OpenJDK 17 + sudo update-java-alternatives -s $(update-java-alternatives -l | grep "\-openjdk" | cut -d " " -f 1) + java -version + gama-headless -help + sudo apt remove -y gama-platform diff --git a/.github/workflows/travis-packaging-linux.yaml b/.github/workflows/travis-packaging-linux.yaml new file mode 100644 index 0000000000..aed7340c31 --- /dev/null +++ b/.github/workflows/travis-packaging-linux.yaml @@ -0,0 +1,60 @@ +name: Packaging linux release + +on: + workflow_call: + inputs: + RELEASE_VERSION: + required: true + default: 2024.03.0 + type: string + +jobs: + debian-archive: + # https://earthly.dev/blog/creating-and-hosting-your-own-deb-packages-and-apt-repo/#step-1-creating-a-deb-package + runs-on: ubuntu-latest + strategy: + matrix: + zipName: ["gama-platform_${{ inputs.RELEASE_VERSION }}-1_amd64", "gama-platform-jdk_${{ inputs.RELEASE_VERSION }}-1_amd64"] + steps: + - name: Prepare vm + run: | + sudo apt-get install -y gcc dpkg-dev gpg + mkdir -p ${{ github.workspace }}/${{ matrix.zipName }}/DEBIAN ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform ${{ github.workspace }}/${{ matrix.zipName }}/usr/share/applications + + - uses: actions/download-artifact@v4 + with: + name: gama-linux + path: ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform + + - name: Get extra files + run: | + unzip ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform/extraresources-unix.zip -d ${{ github.workspace }}/${{ matrix.zipName }} && rm ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform/extraresources-unix.zip + mv ${{ github.workspace }}/${{ matrix.zipName }}/gama-platform.desktop ${{ github.workspace }}/${{ matrix.zipName }}/usr/share/applications/gama-platform.desktop + cd ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform && unzip ${{ matrix.zipName }}.zip && cd - + rm ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform/*.zip + + - name: Tweaks for package w/ JDK + if: contains(matrix.zipName, 'jdk') + run: | + sed -i "s/gama-platform-jdk$/gama-platform/g" ${{ github.workspace }}/${{ matrix.zipName }}/DEBIAN/control + sed -i "s/Package: gama-platform$/Package: gama-platform-jdk/g" ${{ github.workspace }}/${{ matrix.zipName }}/DEBIAN/control + sed -i "/^Depends:.*$/d" ${{ github.workspace }}/${{ matrix.zipName }}/DEBIAN/control + + # Pre-fix relative path for headless helper script (jdk path) + sed -i "s|headless_path=.*|headless_path=/opt/gama-platform/headless|g" ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform/headless/gama-headless.sh + + - name: Fix relative path for headless helper script (plugin path) + run: sed -i "s/\".*\.\/p/\/opt\/gama-platform\/p/g" ${{ github.workspace }}/${{ matrix.zipName }}/opt/gama-platform/headless/gama-headless.sh + + - name: Build DEB archive + run: | + dpkg --build ${{ github.workspace }}/${{ matrix.zipName }} + dpkg --info ${{ github.workspace }}/${{ matrix.zipName }}.deb + + - uses: actions/upload-artifact@v4 + with: + name: gama-linux-deb + if-no-files-found: error + compression-level: 0 + path: | + ${{ github.workspace }}/${{ matrix.zipName }}.deb \ No newline at end of file diff --git a/.github/workflows/travis-packaging-macos-test.yaml b/.github/workflows/travis-packaging-macos-test.yaml new file mode 100644 index 0000000000..9e686b8536 --- /dev/null +++ b/.github/workflows/travis-packaging-macos-test.yaml @@ -0,0 +1,37 @@ +name: Testing MacOS packages + +on: + workflow_call: + +jobs: + macos-test-installer: + # https://earthly.dev/blog/creating-and-hosting-your-own-deb-packages-and-apt-repo/#step-1-creating-a-deb-package + needs: macOS-signing + runs-on: macos-latest + steps: + # Get Linux deb archive + - uses: actions/download-artifact@v4 + with: + name: gama-mac-signed + + - name: Test Gama w/ JDK + run: | + hdiutil attach ./gama.application-macosx.cocoa.x86_64_withJDK.dmg + cp -r /Volumes/Gama/Gama.app ~/ + bash ~/Gama.app/Contents/headless/gama-headless.sh -help + rm -fr ~/Gama.app + hdiutil detach /Volumes/Gama + + - name: Set up Adopt OpenJDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + java-package: jdk + + - name: Test Gama w/o JDK + run: | + hdiutil attach ./gama.application-macosx.cocoa.x86_64.dmg + cp -r /Volumes/Gama/Gama.app ~/ + bash ~/Gama.app/Contents/headless/gama-headless.sh -help + hdiutil detach /Volumes/Gama \ No newline at end of file diff --git a/.github/workflows/travis-packaging-macos.yaml b/.github/workflows/travis-packaging-macos.yaml new file mode 100644 index 0000000000..adbee10438 --- /dev/null +++ b/.github/workflows/travis-packaging-macos.yaml @@ -0,0 +1,137 @@ +name: Packaging MacOS release + +on: + workflow_call: + secrets: + MACOS_CERTIFICATE: + required: true + MACOS_CERTIFICATE_PWD: + required: true + MACOS_KEYCHAIN_PWD: + required: true + MACOS_DEV_ID: + required: true + NOTARY_APPLE_ID: + required: true + NOTARY_PASSWORD: + required: true + NOTARY_TEAM_ID: + required: true + +jobs: + macOS-pre-signing: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: gama-mac-unsigned + + - name: Calculate what Jar to sign + run: | + bash what2sign.sh + echo "\nPrint `needToSign.txt` :" + cat needToSign.txt + + - uses: actions/upload-artifact@v4 + with: + name: gama-mac-what2sign + path: | + ./needToSign.txt + + # + # __ __ _____ ____ _____ + # | \/ | /\ / ____| / __ \ / ____| + # | \ / | / \ | | | | | | (___ + # | |\/| | / /\ \| | | | | |\___ \ + # | | | |/ ____ \ |____ | |__| |____) | + # |_| |_/_/ \_\_____| \____/|_____/ + # + + macOS-signing: + needs: macOS-pre-signing + runs-on: macos-latest + strategy: + matrix: + zipName: [gama.application-macosx.cocoa.x86_64, gama.application-macosx.cocoa.x86_64_withJDK, gama.application-macosx.cocoa.aarch64, gama.application-macosx.cocoa.aarch64_withJDK] + steps: + - uses: actions/checkout@v4 + + - name: Prepare vm + shell: bash + run: | + # Change XCode version + export JAVA_HOME=$JAVA_HOME_17_X64 + mkdir -p ${{ github.workspace }}/artifacts/work + + - uses: actions/download-artifact@v4 + with: + name: gama-mac-what2sign + + - uses: actions/download-artifact@v4 + with: + name: gama-mac-unsigned + path: ./artifacts/ + + - name: Create Keychain + shell: bash + env: + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} + MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} + run: | + # Prepare the keychain - Based on https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions + security create-keychain -p "$MACOS_KEYCHAIN_PWD" build.keychain + security default-keychain -s build.keychain + security unlock-keychain -p "$MACOS_KEYCHAIN_PWD" build.keychain + # Prepare certificate + echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12 + security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_KEYCHAIN_PWD" build.keychain + + - name: Sign Application + shell: bash + env: + working_directory: ${{ github.workspace }}/artifacts/work + # Variables + MACOS_DEV_ID: ${{ secrets.MACOS_DEV_ID }} + MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} + run: | + # Unlock + security unlock-keychain -p "$MACOS_KEYCHAIN_PWD" build.keychain + unzip -q ${{ github.workspace }}/artifacts/${{ matrix.zipName }}.zip -d . && rm ${{ github.workspace }}/artifacts/*.zip + # Sign everything inside app + bash ${{ github.workspace }}/artifacts/mac-sign.sh + plutil -convert xml1 ./artifacts/entitlements.plist && plutil -lint ./artifacts/entitlements.plist + codesign --entitlements "./artifacts/entitlements.plist" --timestamp --options=runtime --force -s "$MACOS_DEV_ID" -v ./Gama.app/Contents/MacOS/Gama + + - name: Packaging signed Application w/o JDK + shell: bash + env: + working_directory: ${{ github.workspace }}/artifacts/work + # Variables + MACOS_DEV_ID: ${{ secrets.MACOS_DEV_ID }} + MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} + # Notarization variables + NOTARY_APPLE_ID: ${{ secrets.NOTARY_APPLE_ID }} + NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }} + NOTARY_TEAM_ID: ${{ secrets.NOTARY_TEAM_ID }} + run: | + # Unlock + security unlock-keychain -p "$MACOS_KEYCHAIN_PWD" build.keychain + # Make DMG - Based on : https://developer.apple.com/forums/thread/128166 + hdiutil create -verbose -srcFolder ./Gama.app -o ./${{ matrix.zipName }}.dmg + codesign -s "$MACOS_DEV_ID" --timestamp -f -v ./${{ matrix.zipName }}.dmg + # Notarize dmg - Based on : https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow#3087734 + xcrun -v notarytool store-credentials "AC_PASSWORD" --apple-id "$NOTARY_APPLE_ID" --team-id "$NOTARY_TEAM_ID" --password "$NOTARY_PASSWORD" + xcrun -v notarytool submit ./${{ matrix.zipName }}.dmg --keychain-profile "AC_PASSWORD" --wait + xcrun -v stapler staple ./${{ matrix.zipName }}.dmg + + - uses: actions/upload-artifact@v4 + env: + working_directory: ${{ github.workspace }}/artifacts/work + with: + name: gama-mac-signed + if-no-files-found: error + compression-level: 0 + path: ./${{ matrix.zipName }}.dmg \ No newline at end of file diff --git a/.github/workflows/travis-packaging-windows.yaml b/.github/workflows/travis-packaging-windows.yaml new file mode 100644 index 0000000000..de2e147769 --- /dev/null +++ b/.github/workflows/travis-packaging-windows.yaml @@ -0,0 +1,43 @@ +name: Packaging Windows release + +on: + workflow_call: + +jobs: + windows-msi: + needs: build + runs-on: windows-latest + strategy: + matrix: + zipName: [gama.application-win32.win32.x86_64.zip, gama.application-win32.win32.x86_64_withJDK.zip] + steps: + - uses: actions/download-artifact@v4 + with: + name: gama-windows + + - uses: actions/download-artifact@v4 + with: + name: travis-scripts + + - name: Change variables for JDK installer + if: contains( matrix.zipName, 'withJDK') + run: | + ((Get-Content -path windows_installer_script.iss -Raw) -replace 'x86_64','x86_64_withJDK') | Set-Content -Path windows_installer_script.iss + Get-Content -path windows_installer_script.iss + + - name: Prepare vm + run: | + mkdir gama_output + mkdir gama_input + 7z x ${{ matrix.zipName }} -ogama_input + + - name: Create installer + run: iscc.exe windows_installer_script.iss + + - uses: actions/upload-artifact@v4 + with: + name: gama-windows-exe + if-no-files-found: error + compression-level: 0 + path: | + gama_output \ No newline at end of file diff --git a/.github/workflows/travis-packaging.yaml b/.github/workflows/travis-packaging.yaml new file mode 100644 index 0000000000..e6ae141d94 --- /dev/null +++ b/.github/workflows/travis-packaging.yaml @@ -0,0 +1,105 @@ +name: Packaging GAMA release + +on: + workflow_call: + inputs: + RELEASE_VERSION: + required: true + default: 2024.03.0 + type: string + secrets: + # === MacOS needs === + MACOS_CERTIFICATE: + required: true + MACOS_CERTIFICATE_PWD: + required: true + MACOS_KEYCHAIN_PWD: + required: true + MACOS_DEV_ID: + required: true + NOTARY_APPLE_ID: + required: true + NOTARY_PASSWORD: + required: true + NOTARY_TEAM_ID: + required: true + # === JDK needs === + GAMA_KEYSTORE_BASE64: + required: true + GAMA_KEYSTORE_STOREPASS: + required: true + # === + +jobs: + + packaging-jdk: + name: Embedding JDK in GAMA + uses: ./.github/workflows/travis-packaging-jdk.yaml + with: + RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} + GAMA_KEYSTORE_BASE64: ${{ inputs.GAMA_KEYSTORE_BASE64 }} + GAMA_KEYSTORE_STOREPASS: ${{ inputs.GAMA_KEYSTORE_STOREPASS }} + + # + # _ _____ _ _ _ ___ __ + # | | |_ _| \ | | | | \ \ / / + # | | | | | \| | | | |\ V / + # | | | | | . ` | | | | > < + # | |____ _| |_| |\ | |__| |/ . \ + # |______|_____|_| \_|\____//_/ \_\\ + # + + packaging-linux: + name: Packaging GAMA for Linux + needs: packaging-jdk + uses: ./.github/workflows/travis-packaging-linux.yaml + with: + RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} + + packaging-linux-test: + needs: packaging-linux + name: Testing Linux package + uses: ./.github/workflows/travis-packaging-linux-test.yaml + with: + RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} + + # + # __ _______ _ _ _____ ______ _______ + # \ \ / /_ _| \ | | __ \ / __ \ \ / / ____| + # \ \ /\ / / | | | \| | | | | | | \ \ /\ / / (___ + # \ \/ \/ / | | | . ` | | | | | | |\ \/ \/ / \___ \ + # \ /\ / _| |_| |\ | |__| | |__| | \ /\ / ____) | + # \/ \/ |_____|_| \_|_____/ \____/ \/ \/ |_____/ + # + + packaging-windows: + name: Packaging GAMA for Windows + needs: packaging-jdk + uses: ./.github/workflows/travis-packaging-windows.yaml + + # + # __ __ _____ ____ _____ + # | \/ | /\ / ____| / __ \ / ____| + # | \ / | / \ | | | | | | (___ + # | |\/| | / /\ \| | | | | |\___ \ + # | | | |/ ____ \ |____ | |__| |____) | + # |_| |_/_/ \_\_____| \____/|_____/ + # + + packaging-macos: + name: Packaging GAMA for MacOS + needs: packaging-jdk + uses: ./.github/workflows/travis-packaging-macos.yaml + secrets: + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} + MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} + MACOS_DEV_ID: ${{ secrets.MACOS_DEV_ID }} + NOTARY_APPLE_ID: ${{ secrets.NOTARY_APPLE_ID }} + NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }} + NOTARY_TEAM_ID: ${{ secrets.NOTARY_TEAM_ID }} + + packaging-macos-test: + needs: packaging-macos + name: Testing MacOS package + uses: ./.github/workflows/travis-packaging-macos-test.yaml \ No newline at end of file diff --git a/.github/workflows/travis-publish-github.yaml b/.github/workflows/travis-publish-github.yaml new file mode 100644 index 0000000000..62ba53877a --- /dev/null +++ b/.github/workflows/travis-publish-github.yaml @@ -0,0 +1,152 @@ +name: Publishing to Github Release + +on: + workflow_call: + inputs: + RELEASE_VERSION: + required: true + default: 2024.03.0 + type: string + IS_STABLE_RELEASE: + required: true + default: false + type: boolean + COMMIT_SHA: + required: true + type: string + secrets: + BOT_TOKEN: + required: true + + +run-name: Publishing ${{ inputs.tag }} to Github Release + +jobs: + publish-github: + name: Publish archives to Github Releases + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # Get zip archives + - uses: actions/download-artifact@v4 + with: + name: gama-zip-builds + + # Get Mac dmg signed archives + - uses: actions/download-artifact@v4 + with: + name: gama-mac-signed + + # Get Linux deb archive + - uses: actions/download-artifact@v4 + with: + name: gama-linux-deb + + # Get Windows exe + - uses: actions/download-artifact@v4 + with: + name: gama-windows-exe + + - name: Get travis scripts ready to use + run: | + # Get full travis script folder + chmod +x ./travis/* + # Debug + ls -lah ${{ github.workspace }} + + - name: Setup new release data and rename files accordingly + id: setup_new_release_data + run: | + date=$(date +'%d/%m/%y %R') + echo "date=$date" >> "$GITHUB_OUTPUT" + + # Add naming file depending on if current file is pre-release or not + fileNameExtension="" + if [[ "${{ inputs.IS_STABLE_RELEASE }}" == "false" ]]; then + timestamp="$(echo $date | cut -d' ' -f1 | sed 's|/|.|g')" + + fileNameExtension=_${timestamp}_${{ inputs.COMMIT_SHA }} + fi + + mkdir ${{ runner.temp }}/files + mv *.zip *.deb *.dmg *.exe ${{ runner.temp }}/files + cd ${{ runner.temp }}/files + + # Windows + for file in *.exe *win32*.zip; do + if [[ "$(echo $file | awk -F'_' '{print $NF}')" == *"withJDK"* ]]; then + mv -v "$file" "GAMA_${{ inputs.RELEASE_VERSION }}_Windows_with_JDK${fileNameExtension}.$(echo $file | awk -F'.' '{print $NF}')" + else + mv -v "$file" "GAMA_${{ inputs.RELEASE_VERSION }}_Windows${fileNameExtension}.$(echo $file | awk -F'.' '{print $NF}')" + fi + done + + # Mac + for file in *.dmg; do + prefix="_${fileNameExtension}.dmg" + if [[ "$(echo $file | awk -F'_' '{print $NF}')" == *"withJDK"* ]]; then + prefix="_with_JDK${prefix}" + fi + + if [[ "$file" == *"aarch64"* ]]; then + prefix="_M1${prefix}" + fi + + prefix="GAMA_${{ inputs.RELEASE_VERSION }}_MacOS${prefix}" + + mv -v $file $prefix + done + + # Linux + for file in *.deb gama-platform*.zip; do + if [[ "$(echo $file | awk -F'_' '{print $1}')" == *"jdk"* ]]; then + mv -v "$file" "GAMA_${{ inputs.RELEASE_VERSION }}_Linux_with_JDK${fileNameExtension}.$(echo $file | awk -F'.' '{print $NF}')" + else + mv -v "$file" "GAMA_${{ inputs.RELEASE_VERSION }}_Linux${fileNameExtension}.$(echo $file | awk -F'.' '{print $NF}')" + fi + done + + - name: Delete old release + uses: cb80/delrel@v0.16.0 + with: + tag: ${{ inputs.RELEASE_VERSION }} + token: ${{ secrets.BOT_TOKEN }} + + - name: Create/Update tag + uses: rickstaa/action-create-tag@v1.6.3 + with: + tag: ${{ inputs.RELEASE_VERSION }} + force_push_tag: true + + - name: Publish alpha to Github + uses: svenstaro/upload-release-action@2.7.0 + if: "${{ !inputs.IS_STABLE_RELEASE }}" + with: + body: | + Alpha release for GAMA ${{ inputs.RELEASE_VERSION }}. Please test and report issues + Last updated on ${{ steps.setup_new_release_data.outputs.date }}. + file: ${{ runner.temp }}/files/* + file_glob: true + make_latest: false + promote: false + prerelease: true + release_name: Alpha Version ${{ inputs.RELEASE_VERSION }} (${{ steps.setup_new_release_data.outputs.commit }}) + tag: ${{ inputs.RELEASE_VERSION }} + repo_token: ${{ secrets.BOT_TOKEN }} + + - name: Publish stable to Github + uses: svenstaro/upload-release-action@2.7.0 + if: "${{ inputs.IS_STABLE_RELEASE }}" + with: + body: | + Release for GAMA ${{ inputs.RELEASE_VERSION }}. + Published on ${{ steps.setup_new_release_data.outputs.date }}. + file: ${{ runner.temp }}/files/* + file_glob: true + make_latest: true + promote: true + prerelease: false + release_name: Version ${{ inputs.RELEASE_VERSION }} + tag: ${{ inputs.RELEASE_VERSION }} + repo_token: ${{ secrets.BOT_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/custom/publish-to-third-party.yml b/.github/workflows/travis-publish-third-party.yaml similarity index 95% rename from .github/workflows/custom/publish-to-third-party.yml rename to .github/workflows/travis-publish-third-party.yaml index 35fb1d6f3e..a42bd9c818 100644 --- a/.github/workflows/custom/publish-to-third-party.yml +++ b/.github/workflows/travis-publish-third-party.yaml @@ -16,18 +16,6 @@ on: BOT_TOKEN: required: true description: "The token used to authenticate to the Github API" - - workflow_dispatch: - inputs: - tag: - description: "The tag of the release to publish" - type: string - required: true - default: 1.9.3 - targets: - description: "The targets to publish to separated by spaces" - type: string - default: "windows linux mac docker" run-name: Auto publishing ${{ inputs.tag }} to external stores diff --git a/.github/workflows/travis-publish.yaml b/.github/workflows/travis-publish.yaml new file mode 100644 index 0000000000..5664c39da7 --- /dev/null +++ b/.github/workflows/travis-publish.yaml @@ -0,0 +1,37 @@ +name: Publishing GAMA release + +on: + workflow_call: + inputs: + RELEASE_VERSION: + required: true + default: 2024.03.0 + type: string + COMMIT_SHA: + required: true + type: string + IS_STABLE_RELEASE: + required: true + default: false + type: boolean + secrets: + BOT_TOKEN: + required: true + +jobs: + + publish-github: + name: Embedding JDK in GAMA + uses: ./.github/workflows/travis-publish-github.yaml + with: + RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} + COMMIT_SHA: ${{ inputs.COMMIT_SHA }} + + publishing-third-party: + needs: publish-github + name: Publish archives to 3rd parties + uses: ./.github/workflows/travis-publish-third-party.yaml + with: + tag: ${{ inputs.RELEASE_VERSION }} + secrets: + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} diff --git a/.github/workflows/github-travis.yml b/.github/workflows/trigger-compilation.yaml similarity index 75% rename from .github/workflows/github-travis.yml rename to .github/workflows/trigger-compilation.yaml index 664e0c98f8..36eed4a444 100644 --- a/.github/workflows/github-travis.yml +++ b/.github/workflows/trigger-compilation.yaml @@ -1,19 +1,23 @@ # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created # For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path -name: Continuous project validationx +name: Continuous project validation on: # Triggers the workflow on push or pull request events but only for the master branch push: branches: [ main ] + paths-ignore: + - '.github/**' + - 'travis/**' + workflow_dispatch: # For manual trigger jobs: compiling-gama: name: Compiling GAMA - uses: ./.github/workflows/gama-build.yml + uses: ./.github/workflows/travis-build.yaml with: get_testing_compiled_archives: true get_all_archives_for_release: false @@ -21,4 +25,4 @@ jobs: testing-gama: name: Testing built GAMA needs: compiling-gama - uses: ./.github/workflows/gama-build-test.yml + uses: ./.github/workflows/travis-build-test.yaml diff --git a/.github/workflows/weekly-doc-regeneration.yaml b/.github/workflows/trigger-doc-regeneration.yaml similarity index 100% rename from .github/workflows/weekly-doc-regeneration.yaml rename to .github/workflows/trigger-doc-regeneration.yaml diff --git a/.github/workflows/trigger-gama-release.yaml b/.github/workflows/trigger-gama-release.yaml new file mode 100644 index 0000000000..242f6d1bc3 --- /dev/null +++ b/.github/workflows/trigger-gama-release.yaml @@ -0,0 +1,103 @@ +name: Make new GAMA release + +on: + workflow_dispatch: + inputs: + IS_STABLE_RELEASE: + description: 'Is this a stable release ?' + required: true + default: false + type: boolean + tag: + description: "The tag of the release to publish (YYYY.MM.0)" + type: string + required: true + default: 2024.03.0 + + +run-name: Building GAMA release + +jobs: + compiling-gama: + name: Compiling GAMA + uses: ./.github/workflows/travis-build.yaml + with: + get_testing_compiled_archives: false + get_all_archives_for_release: true + secrets: + GAMA_KEYSTORE_BASE64: ${{ secrets.GAMA_KEYSTORE_BASE64 }} + GAMA_KEYSTORE_STOREPASS: ${{ secrets.GAMA_KEYSTORE_STOREPASS }} + + travis-scripts: + runs-on: ubuntu-latest + outputs: + commit: ${{ steps.commit.outputs.commit }} + steps: + - uses: actions/checkout@v4 + + - name: Prepare travis-script + id: commit + run: | + chmod +x ${{ github.workspace }}/travis/* + mv ${{ github.workspace }}/gama.product/extraresources ${{ github.workspace }}/travis + + commit=$(git rev-parse --short=7 HEAD) + echo "commit=$commit" >> "$GITHUB_OUTPUT" + + - uses: actions/upload-artifact@v4 + with: + name: travis-scripts + if-no-files-found: error + compression-level: 9 + overwrite: true + path: | + ${{ github.workspace }}/travis + + # + # ██████╗ █████╗ ██████╗██╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗ ██████╗ + # ██╔══██╗██╔══██╗██╔════╝██║ ██╔╝██╔══██╗██╔════╝ ██║████╗ ██║██╔════╝ + # ██████╔╝███████║██║ █████╔╝ ███████║██║ ███╗██║██╔██╗ ██║██║ ███╗ + # ██╔═══╝ ██╔══██║██║ ██╔═██╗ ██╔══██║██║ ██║██║██║╚██╗██║██║ ██║ + # ██║ ██║ ██║╚██████╗██║ ██╗██║ ██║╚██████╔╝██║██║ ╚████║╚██████╔╝ + # ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ + # + + packaging-gama: + needs: [compiling-gama, travis-scripts] + name: Package GAMA + uses: ./.github/workflows/travis-packaging.yaml + with: + RELEASE_VERSION: ${{ inputs.tag }} + secrets: + # === MacOS needs === + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} + MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} + MACOS_DEV_ID: ${{ secrets.MACOS_DEV_ID }} + NOTARY_APPLE_ID: ${{ secrets.NOTARY_APPLE_ID }} + NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }} + NOTARY_TEAM_ID: ${{ secrets.NOTARY_TEAM_ID }} + # === JDK needs === + GAMA_KEYSTORE_BASE64: ${{ secrets.GAMA_KEYSTORE_BASE64 }} + GAMA_KEYSTORE_STOREPASS: ${{ secrets.GAMA_KEYSTORE_STOREPASS }} + + # + # ██████╗ ██╗ ██╗██████╗ ██╗ ██╗███████╗██╗ ██╗██╗███╗ ██╗ ██████╗ + # ██╔══██╗██║ ██║██╔══██╗██║ ██║██╔════╝██║ ██║██║████╗ ██║██╔════╝ + # ██████╔╝██║ ██║██████╔╝██║ ██║███████╗███████║██║██╔██╗ ██║██║ ███╗ + # ██╔═══╝ ██║ ██║██╔══██╗██║ ██║╚════██║██╔══██║██║██║╚██╗██║██║ ██║ + # ██║ ╚██████╔╝██████╔╝███████╗██║███████║██║ ██║██║██║ ╚████║╚██████╔╝ + # ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ ╚═════╝ + # + + publish-gama: + needs: [packaging-gama, travis-scripts] + name: Publish GAMA + uses: ./.github/workflows/travis-publish.yaml + with: + RELEASE_VERSION: ${{ inputs.tag }} + IS_STABLE_RELEASE: ${{ inputs.IS_STABLE_RELEASE }} + COMMIT_SHA: ${{needs.travis-scripts.travis-scripts.outputs.commit}} + secrets: + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} + diff --git a/travis/zip_withjdk.sh b/travis/zip_withjdk.sh index f7aed74ffb..629c8609cf 100644 --- a/travis/zip_withjdk.sh +++ b/travis/zip_withjdk.sh @@ -5,36 +5,31 @@ # set -e -thePATH="$GITHUB_WORKSPACE/ummisco.gama.product/target/products/Gama1.7" - - -echo "zip_withjdk" -cd $GITHUB_WORKSPACE/ummisco.gama.product/target/products -echo "$(git log -1 HEAD --pretty=format:%s)" +archivePath="$GITHUB_WORKSPACE/gama.application" # # Download latest JDK # - -wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.8.1+1 | grep "/OpenJDK17U-jdk_x64_linux.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_linux-17.tar.gz" -wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.8.1+1 | grep "/OpenJDK17U-jdk_x64_window.*.zip\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_win32-17.zip" -wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.8.1+1 | grep "/OpenJDK17U-jdk_x64_mac.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_macosx-17.tar.gz" -wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.8.1+1 | grep "/OpenJDK17U-jdk_aarch64_mac.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_macosx_aarch-17.tar.gz" +echo "=== Download latest JDK" +wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.10+7 | grep "/OpenJDK17U-jdk_x64_linux.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_linux-17.tar.gz" +wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.10+7 | grep "/OpenJDK17U-jdk_x64_window.*.zip\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_win32-17.zip" +wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.10+7 | grep "/OpenJDK17U-jdk_x64_mac.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_macosx-17.tar.gz" +wget -q $(curl https://api.github.com/repos/adoptium/temurin17-binaries/releases/tags/jdk-17.0.10+7 | grep "/OpenJDK17U-jdk_aarch64_mac.*.gz\"" | cut -d ':' -f 2,3 | tr -d \") -O "jdk_macosx_aarch-17.tar.gz" # # Prepare downloaded JDK # - +echo "=== Prepare downloaded JDK" for os in "linux" "macosx" "macosx_aarch" "win32"; do mkdir jdk_$os - echo "unzip jdk $os" - + echo "unzip jdk $os" if [[ -f "jdk_$os-17.tar.gz" ]]; then tar -zxf jdk_$os-17.tar.gz -C jdk_$os/ else unzip -q jdk_$os-17.zip -d jdk_$os fi + mv jdk_$os/jdk-17* jdk_$os/jdk done @@ -42,70 +37,62 @@ done # # Modify .ini file to use custom JDK # - -for folder in "linux/gtk/x86_64" "win32/win32/x86_64" "macosx/cocoa/x86_64/Gama.app/Contents" "macosx/cocoa/aarch64/Gama.app/Contents"; do +echo "=== Creating zip archive of release using custom JDK" +for targetPlatform in "linux.gtk.x86_64" "win32.win32.x86_64" "macosx.cocoa.x86_64" "macosx.cocoa.aarch64"; do # # Get OS (first attribute in the path) # + Add suffix if build for ARM64 system - os="$(echo $folder | cut -d '/' -f 1)$(if [[ "$folder" == *'aarch64'* ]]; then echo '_aarch'; fi )" + os="$(echo $targetPlatform | cut -d '.' -f 1)$(if [[ "$targetPlatform" == *'aarch64'* ]]; then echo '_aarch'; fi )" echo "Add custom JDK for $os" + unzip -q $archivePath-$targetPlatform.zip -d $RUNNER_TMP + # # Specific sub-path for Eclipse in MacOS - folderEclipse=$folder + jdkLocation=$RUNNER_TMP if [[ "$os" == "macosx"* ]]; then - folderEclipse="$folder/Eclipse" + jdkLocation=$RUNNER_TMP/Gama.app/Contents fi - sudo cp -R jdk_$os/jdk $GITHUB_WORKSPACE/ummisco.gama.product/target/products/ummisco.gama.application.product/$folder + # + # Add JDK to build + sudo cp -R jdk_$os/jdk $jdkLocation + # + # Add custom jar signing certificate in custom JDK + if [[ -f "$GITHUB_WORKSPACE/sign.maven" ]]; then + keytool -export -alias gama-platform -file ~/GamaPlatform.cer -keystore ~/gama.keystore -storepass "$GAMA_KEYSTORE_STOREPASS" + # Using default 'changeit' JDK storepass + sudo find $RUNNER_TMP -name "cacerts" -exec keytool -importcert -noprompt -file ~/GamaPlatform.cer -keystore {} -alias gama-platform -storepass "changeit" \; + fi + + # + # Specific sub-path for Eclipse in MacOS + folderEclipse=$jdkLocation + if [[ "$os" == "macosx"* ]]; then + folderEclipse=$jdkLocation/Eclipse + fi + # + # Make GAMA use embedded JDK echo "-vm" > Gama.ini + sed -i '1s/^/-vm/' $folderEclipse/Gama.ini if [[ "$os" == "macosx"* ]]; then - echo "../jdk/Contents/Home/bin/java" >> Gama.ini + sed -i '1,2s/^/..\/jdk\/Contents\/Home\/bin\/java/' $folderEclipse/Gama.ini elif [[ "$os" == "win32"* ]]; then - echo "./jdk/bin/javaw" >> Gama.ini + sed -i '1,2s/^/.\/jdk\/bin\/javaw/' $folderEclipse/Gama.ini else - echo "./jdk/bin/java" >> Gama.ini + sed -i '1,2s/^/.\/jdk\/bin\/java/' $folderEclipse/Gama.ini fi - - cat $GITHUB_WORKSPACE/ummisco.gama.product/target/products/ummisco.gama.application.product/$folderEclipse/Gama.ini >> Gama.ini - rm $GITHUB_WORKSPACE/ummisco.gama.product/target/products/ummisco.gama.application.product/$folderEclipse/Gama.ini - mv Gama.ini $GITHUB_WORKSPACE/ummisco.gama.product/target/products/ummisco.gama.application.product/$folderEclipse/Gama.ini - -done - -# -# Add custom jar signing certificate in custom JDK -# - -if [[ -f "$GITHUB_WORKSPACE/sign.maven" ]]; then - keytool -export -alias gama-platform -file ~/GamaPlatform.cer -keystore ~/gama.keystore -storepass "$GAMA_STORE" - sudo find $GITHUB_WORKSPACE/ummisco.gama.product/target/products/ummisco.gama.application.product -name "cacerts" -exec keytool -importcert -noprompt -file ~/GamaPlatform.cer -keystore {} -alias gama-platform -storepass "changeit" \; -fi + # + # Create final zip archives + cd $RUNNER_TMP + sudo zip -9 -qyr "${archivePath}-${targetPlatform}_withJDK.zip" . && echo "Successfully compressed ${archivePath}-${targetPlatform}_withJDK.zip" || echo "Failed compressing ${archivePath}-${targetPlatform}_withJDK.zip" + cd $GITHUB_WORKSPACE && sudo rm -fr $RUNNER_TMP -# -# Create final zip archives -# -n=0 -RELEASEFILES[$n]="$thePATH-linux.gtk.x86_64_withJDK.zip" -n=$((n+1)) -RELEASEFILES[$n]="$thePATH-win32.win32.x86_64_withJDK.zip" -n=$((n+1)) -RELEASEFILES[$n]="$thePATH-macosx.cocoa.x86_64_withJDK.zip" -n=$((n+1)) -RELEASEFILES[$n]="$thePATH-macosx.cocoa.aarch64_withJDK.zip" - -folderIndex=0 -for folder in "linux/gtk/x86_64" "win32/win32/x86_64" "macosx/cocoa/x86_64" "macosx/cocoa/aarch64"; do - cd $GITHUB_WORKSPACE/ummisco.gama.product/target/products/ummisco.gama.application.product/$folder - - sudo zip -9 -qyr "${RELEASEFILES[$folderIndex]}" . && echo "compressed ${RELEASEFILES[$folderIndex]}" || echo "compress fail ${RELEASEFILES[$folderIndex]}" - - folderIndex=$((folderIndex+1)) done echo DONE