diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index ab921ec588d2..ca41130351e3 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -21,52 +21,113 @@ on: type: string jobs: - # TODO: ADD JOB TO SWITCH THE GITHUB RELEASE FROM DRAFT TO LATEST - publish-sdkman: - uses: ./.github/workflows/publish-sdkman.yml - with: - version: ${{ inputs.version }} - secrets: - CONSUMER-KEY: ${{ secrets.SDKMAN_KEY }} - CONSUMER-TOKEN: ${{ secrets.SDKMAN_TOKEN }} - - publish-winget: - uses: ./.github/workflows/publish-winget.yml - with: - version: ${{ inputs.version }} - secrets: - DOTTYBOT-TOKEN: ${{ secrets.DOTTYBOT_WINGET_TOKEN }} - - compute-digest: - runs-on: ubuntu-latest - outputs: - digest: ${{ steps.digest.outputs.digest }} + republish_artifacts: + permissions: + contents: write # for GH CLI to create a release + runs-on: [self-hosted, Linux] + container: + image: lampepfl/dotty:2024-10-18 + options: --cpu-shares 4096 + volumes: + - ${{ github.workspace }}/../../cache/sbt:/root/.sbt + - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache + - ${{ github.workspace }}/../../cache/general:/root/.cache + + env: + RELEASEBUILD: yes + steps: - - name: Compute the SHA256 of scala3-${{ inputs.version }}-x86_64-pc-win32.zip in GitHub Release - id: digest + ###################################################################################### + ## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA IS DISTRIBUTED USING JAVA 8. ## + ###################################################################################### + - name: Set JDK 8 as default + run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH + - name: Reset existing repo run: | - curl -o artifact.zip -L https://github.com/scala/scala3/releases/download/${{ inputs.version }}/scala3-${{ inputs.version }}-x86_64-pc-win32.zip - echo "digest=$(sha256sum artifact.zip | cut -d " " -f 1)" >> "$GITHUB_OUTPUT" - - build-chocolatey: - uses: ./.github/workflows/build-chocolatey.yml - needs: compute-digest - with: - version: ${{ inputs.version }} - url : 'https://github.com/scala/scala3/releases/download/${{ inputs.version }}/scala3-${{ inputs.version }}-x86_64-pc-win32.zip' - digest : ${{ needs.compute-digest.outputs.digest }} - test-chocolatey: - uses: ./.github/workflows/test-chocolatey.yml - needs: build-chocolatey - with: - version : ${{ inputs.version }} - java-version: 8 - publish-chocolatey: - uses: ./.github/workflows/publish-chocolatey.yml - needs: [ build-chocolatey, test-chocolatey ] - with: - version: ${{ inputs.version }} - secrets: - API-KEY: ${{ secrets.CHOCOLATEY_KEY }} - - # TODO: ADD RELEASE WORKFLOW TO CHOCOLATEY AND OTHER PACKAGE MANAGERS HERE \ No newline at end of file + git config --global --add safe.directory /__w/scala3/scala3 + git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true + + - name: Checkout cleanup script + uses: actions/checkout@v4 + + - name: Cleanup + run: .github/workflows/cleanup.sh + + - name: Git Checkout + uses: actions/checkout@v4 + + - name: Add SBT proxy repositories + run: cp -vf .github/workflows/repositories /root/.sbt/ ; true + + - name: Check compiler version + shell: bash + run : | + version=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1) + echo "This build version: ${version}" + if [ "${version}" != "${{ inputs.version }}" ]; then + echo "Compiler version for this build '${version}', does not match tag: ${{ inputs.version }}" + exit 1 + fi + + + - name: Prepare the SDKs + shell: bash + run : | + git config --global --add safe.directory /__w/scala3/scala3 + prepareSDK() { + distroSuffix="$1" + sbtProject="$2" + distDir="$3" + + # Build binaries + ./project/scripts/sbt "all ${sbtProject}/Universal/packageBin ${sbtProject}/Universal/packageZipTarball" + + outputPath="${distDir}/target/universal/stage" + artifactName="scala3-${{ inputs.version }}${distroSuffix}" + zipArchive="${artifactName}.zip" + tarGzArchive="${artifactName}.tar.gz" + + # Caluclate SHA for each of archive files + for file in "${zipArchive}" "${tarGzArchive}"; do + mv $outputPath/$file $file + sha256sum "${file}" > "${file}.sha256" + done + } + prepareSDK "" "dist" "./dist/" + prepareSDK "-aarch64-pc-linux" "dist-linux-aarch64" "./dist/linux-aarch64/" + prepareSDK "-x86_64-pc-linux" "dist-linux-x86_64" "./dist/linux-x86_64/" + prepareSDK "-aarch64-apple-darwin" "dist-mac-aarch64" "./dist/mac-aarch64/" + 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-${{ inputs.version }}.msi" + # mv scala.msi "${msiInstaller}" + # sha256sum "${msiInstaller}" > "${msiInstaller}.sha256" + + - name: Install GH CLI + uses: dev-hanz-ops/install-gh-cli-action@v0.2.0 + with: + gh-cli-version: 2.59.0 + + # Create the GitHub release + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + shell: bash + run: | + git config --global --add safe.directory /__w/scala3/scala3 + gh release upload ${{ inputs.version }} \ + --clobber \ + scala3-${{ inputs.version }}*.zip \ + scala3-${{ inputs.version }}*.tar.gz \ + scala3-${{ inputs.version }}*.sha256 + + # scala3-${{ inputs.version }}.msi diff --git a/.github/workflows/republish-release.yaml b/.github/workflows/republish-release.yaml deleted file mode 100644 index ea0ca43cb761..000000000000 --- a/.github/workflows/republish-release.yaml +++ /dev/null @@ -1,137 +0,0 @@ -name: Republish GH release - -on: - workflow_call: - inputs: - version: - required: true - type: string - -env: - DOTTY_CI_RUN: true - -# In this file, we set `--cpu-shares 4096` on every job. This might seem useless -# since it means that every container has the same weight which should be -# equivalent to doing nothing, but it turns out that OpenJDK computes -# `Runtime.getRuntime.availableProcessors` by dividing the cpu-shares value if -# it exists by 1024 (cf -# http://mail.openjdk.java.net/pipermail/hotspot-dev/2019-January/036087.html), -# so this means that we effectively run every job with 4 cores. This is much -# nicer than setting `--cpus 4` because the latter enforces CPU quotas and ends -# up slowing our jobs more than needed. It's equivalent to running the JVM with -# `-XX:ActiveProcessorCount=4`, but since our tests can spawn new JVM in many -# places, it would be very hard to ensure that this option is always passed to -# `java` (we could use the `_JAVA_OPTIONS` environment variable, but this prints -# text on stderr and so can break tests which check the output of a program). - -jobs: - publish_release: - permissions: - contents: write # for GH CLI to create a release - runs-on: [self-hosted, Linux] - container: - image: lampepfl/dotty:2024-10-18 - options: --cpu-shares 4096 - volumes: - - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache - - ${{ github.workspace }}/../../cache/general:/root/.cache - - env: - RELEASEBUILD: yes - - steps: - ###################################################################################### - ## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA IS DISTRIBUTED USING JAVA 8. ## - ###################################################################################### - - name: Set JDK 8 as default - run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH - - name: Reset existing repo - run: | - git config --global --add safe.directory /__w/scala3/scala3 - git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - - - name: Checkout cleanup script - uses: actions/checkout@v4 - - - name: Cleanup - run: .github/workflows/cleanup.sh - - - name: Git Checkout - uses: actions/checkout@v4 - - - name: Add SBT proxy repositories - run: cp -vf .github/workflows/repositories /root/.sbt/ ; true - - - name: Check compiler version - shell: bash - run : | - version=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1) - echo "This build version: ${version}" - if [ "${version}" != "${{ inputs.version }}" ]; then - echo "Compiler version for this build '${version}', does not match tag: ${{ inputs.version }}" - exit 1 - fi - - - - name: Prepare the SDKs - shell: bash - run : | - git config --global --add safe.directory /__w/scala3/scala3 - prepareSDK() { - distroSuffix="$1" - sbtProject="$2" - distDir="$3" - - # Build binaries - ./project/scripts/sbt "all ${sbtProject}/Universal/packageBin ${sbtProject}/Universal/packageZipTarball" - - outputPath="${distDir}/target/universal/stage" - artifactName="scala3-${{ inputs.version }}${distroSuffix}" - zipArchive="${artifactName}.zip" - tarGzArchive="${artifactName}.tar.gz" - - # Caluclate SHA for each of archive files - for file in "${zipArchive}" "${tarGzArchive}"; do - mv $outputPath/$file $file - sha256sum "${file}" > "${file}.sha256" - done - } - prepareSDK "" "dist" "./dist/" - prepareSDK "-aarch64-pc-linux" "dist-linux-aarch64" "./dist/linux-aarch64/" - prepareSDK "-x86_64-pc-linux" "dist-linux-x86_64" "./dist/linux-x86_64/" - prepareSDK "-aarch64-apple-darwin" "dist-mac-aarch64" "./dist/mac-aarch64/" - 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-${{ inputs.version }}.msi" - # mv scala.msi "${msiInstaller}" - # sha256sum "${msiInstaller}" > "${msiInstaller}.sha256" - - - name: Install GH CLI - uses: dev-hanz-ops/install-gh-cli-action@v0.2.0 - with: - gh-cli-version: 2.59.0 - - # Create the GitHub release - - name: Create GitHub Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - shell: bash - run: | - git config --global --add safe.directory /__w/scala3/scala3 - gh release upload ${{ inputs.version }} \ - --clobber \ - scala3-${{ inputs.version }}*.zip \ - scala3-${{ inputs.version }}*.tar.gz \ - scala3-${{ inputs.version }}*.sha256 - - # scala3-${{ inputs.version }}.msi