From 7013ffb56b123b0eaa4399298d07a8e5816ffab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 23 Sep 2024 19:35:57 +0200 Subject: [PATCH] Rename artifacts to match the releases --- .github/workflows/ci.yml | 82 ++++++++++++++++++++++++---------------- scripts/build-appimage | 6 ++- 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e35268af6f..b1950e2d44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,20 @@ concurrency: cancel-in-progress: true jobs: + get_artifact_name: + name: Get version info + runs-on: ubuntu-latest + outputs: + name: ${{ steps.ghd.outputs.describe }} + short-sha: ${{ steps.ghd.outputs.short-sha }} + distance: ${{ steps.ghd.outputs.distance }} + tag: ${{ steps.ghd.outputs.tag }} + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Git describe + id: ghd + uses: proudust/gh-describe@v2 lint-commit: name: Lint Commit Message if: github.event_name == 'pull_request' @@ -72,6 +86,7 @@ jobs: g2dat: name: g2.dat runs-on: ubuntu-latest + needs: get_artifact_name steps: - name: Checkout OpenRCT2 uses: actions/checkout@v4 @@ -89,12 +104,12 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: g2.dat + name: g2-${{ needs.get_artifact_name.outputs.name }}.dat path: g2.dat windows: name: Windows runs-on: windows-latest - needs: check-code-formatting + needs: [check-code-formatting, get_artifact_name] strategy: fail-fast: false matrix: @@ -112,11 +127,6 @@ jobs: fi - name: Checkout uses: actions/checkout@v4 - - name: Git describe for shallow checkout - id: ghd - uses: proudust/gh-describe@v2 - - name: Update GA environment - run: echo "OPENRCT2_DESCRIBE=${{ steps.ghd.outputs.describe }}" >> $GITHUB_ENV - name: Install MSVC problem matcher uses: ammaraskar/msvc-problem-matcher@master - name: Build OpenRCT2 @@ -127,10 +137,15 @@ jobs: build-portable build-symbols build-installer -i + - name: Rename artifacts + run: | + mv artifacts/openrct2-portable-*.zip artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-windows-portable-$PLATFORM.zip + mv artifacts/openrct2-installer-*.exe artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-windows-installer-$PLATFORM.exe + mv artifacts/openrct2-symbols-*.zip artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-windows-symbols-$PLATFORM.zip - name: Upload artifacts (CI) uses: actions/upload-artifact@v4 with: - name: OpenRCT2-${{ runner.os }}-${{ matrix.platform }} + name: OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-${{ runner.os }}-${{ matrix.platform }} path: artifacts if-no-files-found: error - name: Run Tests @@ -145,9 +160,9 @@ jobs: run: | . scripts/setenv if [[ "$OPENRCT2_PUSH" == "true" ]]; then - upload-build artifacts/openrct2-portable-*.zip "windows-portable-$PLATFORM.zip" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH - upload-build artifacts/openrct2-installer-*.exe "windows-installer-$PLATFORM.exe" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH - upload-build artifacts/openrct2-symbols-*.zip "windows-symbols-$PLATFORM.zip" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH + upload-build artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-windows-portable-$PLATFORM.zip "windows-portable-$PLATFORM.zip" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH + upload-build artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-windows-installer-$PLATFORM.exe "windows-installer-$PLATFORM.exe" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH + upload-build artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-windows-symbols-$PLATFORM.zip "windows-symbols-$PLATFORM.zip" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH upload-backtrace-symbols artifacts/openrct2-symbols-*.zip else echo 'Not going to push build' @@ -155,7 +170,7 @@ jobs: windows-mingw: name: Windows (${{ matrix.platform_name }}) using mingw runs-on: ubuntu-latest - needs: check-code-formatting + needs: [check-code-formatting, get_artifact_name] container: openrct2/openrct2-build:14-mingw strategy: fail-fast: false @@ -185,7 +200,7 @@ jobs: if: matrix.platform == 'NT5.1' uses: actions/upload-artifact@v4 with: - name: OpenRCT2-Windows-${{ matrix.platform }} + name: OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-Windows-mingw-${{ matrix.platform }} path: bin/openrct2.exe if-no-files-found: error macos-cmake: @@ -251,7 +266,7 @@ jobs: macos-universal: name: macOS universal app bundle runs-on: macos-14 - needs: macos-cmake + needs: [macos-cmake, get_artifact_name] steps: - name: Checkout uses: actions/checkout@v4 @@ -279,25 +294,25 @@ jobs: mv macos_universal/OpenRCT2-universal.app artifacts/OpenRCT2.app echo -e "\033[0;36mCompressing OpenRCT2.app...\033[0m" cd artifacts - zip -rqy openrct2-macos.zip OpenRCT2.app + zip -rqy OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-macos-universal.zip OpenRCT2.app - name: Upload artifacts (CI) uses: actions/upload-artifact@v4 with: - name: OpenRCT2-${{ runner.os }}-universal - path: artifacts/openrct2-macos.zip + name: OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-${{ runner.os }}-universal + path: artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-macos-universal.zip if-no-files-found: error - name: Upload artifacts (openrct2.org) run: | . scripts/setenv if [[ "$OPENRCT2_PUSH" == "true" ]]; then - upload-build artifacts/openrct2-macos.zip macos-universal.zip $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH + upload-build artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-macos-universal.zip macos-universal.zip $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH else echo 'Not going to push build' fi linux-portable: name: ${{ matrix.distro }} Linux (${{ matrix.release }}, ${{ matrix.platform }}, portable) runs-on: ubuntu-latest - needs: check-code-formatting + needs: [check-code-formatting, get_artifact_name] container: ${{ matrix.image }} strategy: fail-fast: false @@ -328,29 +343,28 @@ jobs: - name: Build OpenRCT2 run: . scripts/setenv -q && build -DWITH_TESTS=on -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DPORTABLE=ON ${{ matrix.build_flags }} - name: Build artifacts - run: . scripts/setenv -q && build-portable artifacts/OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}.tar.gz bin/install/usr + run: . scripts/setenv -q && build-portable artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-${{ runner.os }}-${{ matrix.release }}-${{ matrix.platform }}.tar.gz bin/install/usr - name: Upload artifacts (CI) uses: actions/upload-artifact@v4 with: - name: OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }} + name: OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-${{ runner.os }}-${{ matrix.release }}-${{ matrix.platform }} path: artifacts if-no-files-found: error - name: Run Tests run: . scripts/setenv -q && run-tests - - name: Upload artifacts (openrct2.org) run: | # Build identification code: https://github.com/Limetric/OpenRCT2.org/blob/e5b738f3dadcc5a3b78e8dfd434756ff31eaa1d3/src/misc/releaseAsset.js#L94-L116 . scripts/setenv -q if [[ "$OPENRCT2_PUSH" == "true" ]]; then - upload-build artifacts/OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}.tar.gz linux-${{ matrix.platform }}-${{ matrix.distro }}.tar.gz $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH + upload-build artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-${{ runner.os }}-${{ matrix.release }}-${{ matrix.platform }}.tar.gz linux-${{ matrix.platform }}-${{ matrix.distro }}.tar.gz $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH else echo 'Not going to push build' fi linux-appimage: name: Ubuntu Linux (AppImage, x86_64) runs-on: ubuntu-latest - needs: check-code-formatting + needs: [check-code-formatting, get_artifact_name] container: openrct2/openrct2-build:16-noble steps: - name: Checkout @@ -364,11 +378,13 @@ jobs: - name: Build OpenRCT2 run: . scripts/setenv -q && build -DCMAKE_BUILD_TYPE=Release -DAPPIMAGE=ON -DOPENRCT2_USE_CCACHE=on - name: Build AppImage + env: + APPIMAGE_FILE_NAME: OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-linux-x86_64.AppImage run: . scripts/setenv -q && build-appimage - name: Upload artifacts (CI) uses: actions/upload-artifact@v4 with: - name: OpenRCT2-AppImage + name: OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-AppImage path: artifacts if-no-files-found: error - name: Upload artifacts (openrct2.org) @@ -376,7 +392,7 @@ jobs: # Build identification code: https://github.com/Limetric/OpenRCT2.org/blob/e5b738f3dadcc5a3b78e8dfd434756ff31eaa1d3/src/misc/releaseAsset.js#L94-L116 . scripts/setenv -q if [[ "$OPENRCT2_PUSH" == "true" ]]; then - upload-build artifacts/OpenRCT2-x86_64.AppImage linux.AppImage $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH + upload-build artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-linux-x86_64.AppImage linux.AppImage $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH else echo 'Not going to push build' fi @@ -424,7 +440,7 @@ jobs: linux-clang-tests: name: Ubuntu Linux (debug) using clang, coverage enabled runs-on: ubuntu-latest - needs: check-code-formatting + needs: [check-code-formatting, get_artifact_name] container: openrct2/openrct2-build:16-noble steps: - name: Checkout @@ -456,7 +472,7 @@ jobs: - name: Upload artifacts (CI) uses: actions/upload-artifact@v4 with: - name: OpenRCT2-${{ runner.os }}-coverage + name: OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-${{ runner.os }}-coverage path: | bin/*profdata* bin/coverage.json* @@ -465,7 +481,7 @@ jobs: android: name: Android runs-on: ubuntu-latest - needs: check-code-formatting + needs: [check-code-formatting, get_artifact_name] container: openrct2/openrct2-build:14-android steps: - name: Checkout @@ -480,21 +496,21 @@ jobs: run: | . scripts/setenv pushd src/openrct2-android - ./gradlew app:assembleRelease + ./gradlew app:assembleRelease popd mkdir -p artifacts - mv src/openrct2-android/app/build/outputs/apk/release/app-release.apk artifacts/openrct2-arm.apk + mv src/openrct2-android/app/build/outputs/apk/release/app-release.apk artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-android-arm.apk - name: Upload artifacts (CI) uses: actions/upload-artifact@v4 with: - name: OpenRCT2-Android + name: OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-Android path: artifacts if-no-files-found: error - name: Upload artifacts (openrct2.org) run: | . scripts/setenv -q if [[ "$OPENRCT2_PUSH" == "true" ]]; then - upload-build artifacts/openrct2-arm.apk android-arm.apk $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH + upload-build artifacts/OpenRCT2-${{ needs.get_artifact_name.outputs.name }}-android-arm.apk android-arm.apk $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH else echo 'Not going to push build' fi diff --git a/scripts/build-appimage b/scripts/build-appimage index 3e3b88c207..6f6becc193 100755 --- a/scripts/build-appimage +++ b/scripts/build-appimage @@ -15,5 +15,9 @@ pushd bin $linuxdeploy --appimage-extract-and-run --appdir install/ --output appimage --desktop-file install/usr/share/applications/openrct2.desktop popd mkdir -p artifacts -mv bin/OpenRCT2*.AppImage artifacts +# If APPIMAGE_FILE_NAME is set, use it as the filename, otherwise use the default +if [ -z "$APPIMAGE_FILE_NAME" ]; then + APPIMAGE_FILE_NAME=OpenRCT2-$OPENRCT2_VERSION-linux-x86_64.AppImage +fi +mv bin/OpenRCT2-x86_64.AppImage artifacts/$APPIMAGE_FILE_NAME rm $linuxdeploy