Skip to content

Commit

Permalink
Overtake releases.yml to trigger workflow without merging to main
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Dec 12, 2024
1 parent e71a135 commit 180c0e4
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 184 deletions.
155 changes: 108 additions & 47 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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/[email protected]
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
137 changes: 0 additions & 137 deletions .github/workflows/republish-release.yaml

This file was deleted.

0 comments on commit 180c0e4

Please sign in to comment.