From c4572ba95a86744302d5fca396ca09ad7df6b98f Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 6 Nov 2024 13:23:03 +0100 Subject: [PATCH] Add .msi artifacts to release assets (#21834) We now include .msi files produced by `build-msi-package` in release assets including both .msi file and it's sha256 Resolves #21820 [Cherry-picked 83c75dd62a90c6e60f9135b020cd508756c90d6e] --- .github/workflows/ci.yaml | 80 ++++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cd0f0f627bf9..600f15059fb0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -729,7 +729,7 @@ jobs: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache - ${{ github.workspace }}/../../cache/general:/root/.cache - needs: [test_non_bootstrapped, test, mima, community_build_a, community_build_b, community_build_c, test_sbt, test_java8, build-sdk-package] + needs: [test_non_bootstrapped, test, mima, community_build_a, community_build_b, community_build_c, test_sbt, test_java8, build-sdk-package, build-msi-package] if: "github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')" @@ -812,6 +812,18 @@ jobs: prepareSDK "-x86_64-apple-darwin" "dist-mac-x86_64" "./dist/mac-x86_64/" prepareSDK "-x86_64-pc-win32" "dist-win-x86_64" "./dist/win-x86_64/" + - name: Download MSI package + uses: actions/download-artifact@v4 + with: + name: scala.msi + path: . + - name: Prepare MSI package + shell: bash + run: | + msiInstaller="scala3-${{ env.RELEASE_TAG }}.msi" + mv scala.msi "${msiInstaller}" + sha256sum "${msiInstaller}" > "${msiInstaller}.sha256" + # Create the GitHub release - name: Create GitHub Release id: create_gh_release @@ -825,10 +837,10 @@ jobs: draft: true prerelease: ${{ contains(env.RELEASE_TAG, '-') }} - # The following steps are generated using template: - # def template(distribution: String, suffix: String) = - # def upload(kind: String, path: String, contentType: String) = - # s"""- name: Upload $kind to GitHub Release ($distribution) + # The following upload steps are generated using template: + # val baseFileName = "scala3-${{ env.RELEASE_TAG }}" + # def upload(kind: String, path: String, contentType: String, distribution: String) = + # s"""- name: Upload $kind to GitHub Release ($distribution) # uses: actions/upload-release-asset@v1 # env: # GITHUB_TOKEN: $${{ secrets.GITHUB_TOKEN }} @@ -837,24 +849,33 @@ jobs: # asset_path: ./${path} # asset_name: ${path} # asset_content_type: ${contentType}""" - # val filename = s"scala3-$${{ env.RELEASE_TAG }}${suffix}" + # def uploadSDK(distribution: String, suffix: String) = + # val filename = s"${baseFileName}${suffix}" # s""" # # $distribution - # ${upload("zip archive", s"$filename.zip", "application/zip")} - # ${upload("zip archive SHA", s"$filename.zip.sha256", "text/plain")} - # ${upload("tar.gz archive", s"$filename.tar.gz", "application/gzip")} - # ${upload("tar.gz archive SHA", s"$filename.tar.gz.sha256", "text/plain")} + # ${upload("zip archive", s"$filename.zip", "application/zip", distribution)} + # ${upload("zip archive SHA", s"$filename.zip.sha256", "text/plain", distribution)} + # ${upload("tar.gz archive", s"$filename.tar.gz", "application/gzip", distribution)} + # ${upload("tar.gz archive SHA", s"$filename.tar.gz.sha256", "text/plain", distribution)} + # """ + # def uploadMSI() = + # val distribution = "Windows x86_64 MSI" + # s""" + # # $distribution + # ${upload(".msi file", s"${baseFileName}.msi", "application/x-msi", distribution)} + # ${upload(".msi file SHA", s"${baseFileName}.msi.sha256", "text/plain", distribution)} # """ - # @main def gen = # Seq( - # template("Universal", ""), - # template("Linux x86-64", "-x86_64-pc-linux"), - # template("Linux aarch64", "-aarch64-pc-linux"), - # template("Mac x86-64", "-x86_64-apple-darwin"), - # template("Mac aarch64", "-aarch64-apple-darwin"), - # template("Windows x86_64", "-x86_64-pc-win32") + # uploadSDK("Universal", ""), + # uploadSDK("Linux x86-64", "-x86_64-pc-linux"), + # uploadSDK("Linux aarch64", "-aarch64-pc-linux"), + # uploadSDK("Mac x86-64", "-x86_64-apple-darwin"), + # uploadSDK("Mac aarch64", "-aarch64-apple-darwin"), + # uploadSDK("Windows x86_64", "-x86_64-pc-win32"), + # uploadMSI() # ).foreach(println) + # Universal - name: Upload zip archive to GitHub Release (Universal) uses: actions/upload-release-asset@v1 @@ -1088,6 +1109,27 @@ jobs: asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.tar.gz.sha256 asset_content_type: text/plain + + # Windows x86_64 MSI + - name: Upload .msi file to GitHub Release (Windows x86_64 MSI) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_gh_release.outputs.upload_url }} + asset_path: ./scala3-${{ env.RELEASE_TAG }}.msi + asset_name: scala3-${{ env.RELEASE_TAG }}.msi + asset_content_type: application/x-msi + - name: Upload .msi file SHA to GitHub Release (Windows x86_64 MSI) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_gh_release.outputs.upload_url }} + asset_path: ./scala3-${{ env.RELEASE_TAG }}.msi.sha256 + asset_name: scala3-${{ env.RELEASE_TAG }}.msi.sha256 + asset_content_type: text/plain + - name: Publish Release run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleUpload" @@ -1114,7 +1156,9 @@ jobs: build-msi-package: uses: ./.github/workflows/build-msi.yml - if : github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]') + if : + (github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')) || + (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) test-msi-package: uses: ./.github/workflows/test-msi.yml