Skip to content

Commit 4940017

Browse files
committed
Overtake releases.yml to trigger workflow without merging to main
1 parent 749c3e7 commit 4940017

File tree

2 files changed

+108
-184
lines changed

2 files changed

+108
-184
lines changed

.github/workflows/releases.yml

Lines changed: 108 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,113 @@ on:
2121
type: string
2222

2323
jobs:
24-
# TODO: ADD JOB TO SWITCH THE GITHUB RELEASE FROM DRAFT TO LATEST
25-
publish-sdkman:
26-
uses: ./.github/workflows/publish-sdkman.yml
27-
with:
28-
version: ${{ inputs.version }}
29-
secrets:
30-
CONSUMER-KEY: ${{ secrets.SDKMAN_KEY }}
31-
CONSUMER-TOKEN: ${{ secrets.SDKMAN_TOKEN }}
32-
33-
publish-winget:
34-
uses: ./.github/workflows/publish-winget.yml
35-
with:
36-
version: ${{ inputs.version }}
37-
secrets:
38-
DOTTYBOT-TOKEN: ${{ secrets.DOTTYBOT_WINGET_TOKEN }}
39-
40-
compute-digest:
41-
runs-on: ubuntu-latest
42-
outputs:
43-
digest: ${{ steps.digest.outputs.digest }}
24+
republish_artifacts:
25+
permissions:
26+
contents: write # for GH CLI to create a release
27+
runs-on: [self-hosted, Linux]
28+
container:
29+
image: lampepfl/dotty:2024-10-18
30+
options: --cpu-shares 4096
31+
volumes:
32+
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
33+
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
34+
- ${{ github.workspace }}/../../cache/general:/root/.cache
35+
36+
env:
37+
RELEASEBUILD: yes
38+
4439
steps:
45-
- name: Compute the SHA256 of scala3-${{ inputs.version }}-x86_64-pc-win32.zip in GitHub Release
46-
id: digest
40+
######################################################################################
41+
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA IS DISTRIBUTED USING JAVA 8. ##
42+
######################################################################################
43+
- name: Set JDK 8 as default
44+
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
45+
- name: Reset existing repo
4746
run: |
48-
curl -o artifact.zip -L https://github.com/scala/scala3/releases/download/${{ inputs.version }}/scala3-${{ inputs.version }}-x86_64-pc-win32.zip
49-
echo "digest=$(sha256sum artifact.zip | cut -d " " -f 1)" >> "$GITHUB_OUTPUT"
50-
51-
build-chocolatey:
52-
uses: ./.github/workflows/build-chocolatey.yml
53-
needs: compute-digest
54-
with:
55-
version: ${{ inputs.version }}
56-
url : 'https://github.com/scala/scala3/releases/download/${{ inputs.version }}/scala3-${{ inputs.version }}-x86_64-pc-win32.zip'
57-
digest : ${{ needs.compute-digest.outputs.digest }}
58-
test-chocolatey:
59-
uses: ./.github/workflows/test-chocolatey.yml
60-
needs: build-chocolatey
61-
with:
62-
version : ${{ inputs.version }}
63-
java-version: 8
64-
publish-chocolatey:
65-
uses: ./.github/workflows/publish-chocolatey.yml
66-
needs: [ build-chocolatey, test-chocolatey ]
67-
with:
68-
version: ${{ inputs.version }}
69-
secrets:
70-
API-KEY: ${{ secrets.CHOCOLATEY_KEY }}
71-
72-
# TODO: ADD RELEASE WORKFLOW TO CHOCOLATEY AND OTHER PACKAGE MANAGERS HERE
47+
git config --global --add safe.directory /__w/scala3/scala3
48+
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
49+
50+
- name: Checkout cleanup script
51+
uses: actions/checkout@v4
52+
53+
- name: Cleanup
54+
run: .github/workflows/cleanup.sh
55+
56+
- name: Git Checkout
57+
uses: actions/checkout@v4
58+
59+
- name: Add SBT proxy repositories
60+
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
61+
62+
- name: Check compiler version
63+
shell: bash
64+
run : |
65+
version=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1)
66+
echo "This build version: ${version}"
67+
if [ "${version}" != "${{ inputs.version }}" ]; then
68+
echo "Compiler version for this build '${version}', does not match tag: ${{ inputs.version }}"
69+
exit 1
70+
fi
71+
72+
73+
- name: Prepare the SDKs
74+
shell: bash
75+
run : |
76+
git config --global --add safe.directory /__w/scala3/scala3
77+
prepareSDK() {
78+
distroSuffix="$1"
79+
sbtProject="$2"
80+
distDir="$3"
81+
82+
# Build binaries
83+
./project/scripts/sbt "all ${sbtProject}/Universal/packageBin ${sbtProject}/Universal/packageZipTarball"
84+
85+
outputPath="${distDir}/target/universal/stage"
86+
artifactName="scala3-${{ inputs.version }}${distroSuffix}"
87+
zipArchive="${artifactName}.zip"
88+
tarGzArchive="${artifactName}.tar.gz"
89+
90+
# Caluclate SHA for each of archive files
91+
for file in "${zipArchive}" "${tarGzArchive}"; do
92+
mv $outputPath/$file $file
93+
sha256sum "${file}" > "${file}.sha256"
94+
done
95+
}
96+
prepareSDK "" "dist" "./dist/"
97+
prepareSDK "-aarch64-pc-linux" "dist-linux-aarch64" "./dist/linux-aarch64/"
98+
prepareSDK "-x86_64-pc-linux" "dist-linux-x86_64" "./dist/linux-x86_64/"
99+
prepareSDK "-aarch64-apple-darwin" "dist-mac-aarch64" "./dist/mac-aarch64/"
100+
prepareSDK "-x86_64-apple-darwin" "dist-mac-x86_64" "./dist/mac-x86_64/"
101+
prepareSDK "-x86_64-pc-win32" "dist-win-x86_64" "./dist/win-x86_64/"
102+
103+
# - name: Download MSI package
104+
# uses: actions/download-artifact@v4
105+
# with:
106+
# name: scala.msi
107+
# path: .
108+
# - name: Prepare MSI package
109+
# shell: bash
110+
# run: |
111+
# msiInstaller="scala3-${{ inputs.version }}.msi"
112+
# mv scala.msi "${msiInstaller}"
113+
# sha256sum "${msiInstaller}" > "${msiInstaller}.sha256"
114+
115+
- name: Install GH CLI
116+
uses: dev-hanz-ops/[email protected]
117+
with:
118+
gh-cli-version: 2.59.0
119+
120+
# Create the GitHub release
121+
- name: Create GitHub Release
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
124+
shell: bash
125+
run: |
126+
git config --global --add safe.directory /__w/scala3/scala3
127+
gh release upload ${{ inputs.version }} \
128+
--clobber \
129+
scala3-${{ inputs.version }}*.zip \
130+
scala3-${{ inputs.version }}*.tar.gz \
131+
scala3-${{ inputs.version }}*.sha256
132+
133+
# scala3-${{ inputs.version }}.msi

.github/workflows/republish-release.yaml

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)