-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Backport Chocolatey support to Scala LTS #22095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
WojciechMazur
merged 5 commits into
scala:lts-3.3
from
WojciechMazur:backport/choco_20534+21221
Dec 9, 2024
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
332f99b
Backport Chocolatey support to Scala LTS
WojciechMazur c078f6e
Use SHA of previously uploaded zip
WojciechMazur a2c5306
Don't use prebuilt archive, create zip with content of dist/target/pa…
WojciechMazur a3aa7ab
Use `dist/pack` instead of `dist/packArchive`
WojciechMazur bca1a98
Update chocolatey readme
WojciechMazur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
################################################################################################### | ||
### THIS IS A REUSABLE WORKFLOW TO BUILD SCALA WITH CHOCOLATEY ### | ||
### HOW TO USE: ### | ||
### ### | ||
### NOTE: ### | ||
### ### | ||
################################################################################################### | ||
|
||
|
||
name: Build 'scala' Chocolatey Package | ||
run-name: Build 'scala' (${{ inputs.version }}) Chocolatey Package | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: true | ||
type : string | ||
url: | ||
required: true | ||
type : string | ||
digest: | ||
required: true | ||
type : string | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Replace the version placeholder | ||
uses: richardrigutins/replace-in-files@v2 | ||
with: | ||
files: ./pkgs/chocolatey/scala.nuspec | ||
search-text: '@LAUNCHER_VERSION@' | ||
replacement-text: ${{ inputs.version }} | ||
- name: Replace the URL placeholder | ||
uses: richardrigutins/replace-in-files@v2 | ||
with: | ||
files: ./pkgs/chocolatey/tools/chocolateyInstall.ps1 | ||
search-text: '@LAUNCHER_URL@' | ||
replacement-text: ${{ inputs.url }} | ||
- name: Replace the CHECKSUM placeholder | ||
uses: richardrigutins/replace-in-files@v2 | ||
with: | ||
files: ./pkgs/chocolatey/tools/chocolateyInstall.ps1 | ||
search-text: '@LAUNCHER_SHA256@' | ||
replacement-text: ${{ inputs.digest }} | ||
- name: Build the Chocolatey package (.nupkg) | ||
run: choco pack ./pkgs/chocolatey/scala.nuspec --out ./pkgs/chocolatey | ||
- name: Upload the Chocolatey package to GitHub | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: scala.nupkg | ||
path: ./pkgs/chocolatey/scala.${{ inputs.version }}.nupkg | ||
if-no-files-found: error | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
################################################################################################### | ||
### THIS IS A REUSABLE WORKFLOW TO BUILD THE SCALA LAUNCHERS ### | ||
### HOW TO USE: ### | ||
### - THSI WORKFLOW WILL PACKAGE THE ALL THE LAUNCHERS AND UPLOAD THEM TO GITHUB ARTIFACTS ### | ||
### ### | ||
### NOTE: ### | ||
### - SEE THE WORFLOW FOR THE NAMES OF THE ARTIFACTS ### | ||
################################################################################################### | ||
|
||
|
||
name: Build Scala Launchers | ||
run-name: Build Scala Launchers | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
java-version: | ||
type : string | ||
required : true | ||
outputs: | ||
universal-id: | ||
description: ID of the `universal` package from GitHub Artifacts (Authentication Required) | ||
value : ${{ jobs.build.outputs.universal-id }} | ||
universal-digest: | ||
description: The SHA256 of the uploaded artifact (universal) | ||
value : ${{ jobs.build.outputs.universal-digest }} | ||
|
||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
universal-id : ${{ steps.universal.outputs.artifact-id }} | ||
universal-digest : ${{ steps.universal-digest.outputs.digest }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: ${{ inputs.java-version }} | ||
cache : sbt | ||
|
||
- name: Build and pack the SDK (universal) | ||
run : ./project/scripts/sbt dist/packArchive | ||
|
||
- name: Upload zip archive to GitHub Artifact (universal) | ||
uses: actions/upload-artifact@v4 | ||
id : universal | ||
with: | ||
path: ./dist/target/pack/* | ||
name: scala3-universal | ||
|
||
- name: Compute SHA256 of the uploaded artifact (universal) | ||
id : universal-digest | ||
run : | | ||
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o artifact.zip -L https://api.github.com/repos/scala/scala3/actions/artifacts/${{ steps.universal.outputs.artifact-id }}/zip | ||
echo "digest=$(sha256sum artifact.zip | cut -d " " -f 1)" >> "$GITHUB_OUTPUT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
################################################################################################### | ||
### THIS IS A REUSABLE WORKFLOW TO PUBLISH SCALA TO CHOCOLATEY ### | ||
### HOW TO USE: ### | ||
### - THE RELEASE WORKFLOW SHOULD CALL THIS WORKFLOW ### | ||
### - IT WILL PUBLISH TO CHOCOLATEY THE MSI ### | ||
### ### | ||
### NOTE: ### | ||
### - WE SHOULD KEEP IN SYNC THE NAME OF THE MSI WITH THE ACTUAL BUILD ### | ||
### - WE SHOULD KEEP IN SYNC THE URL OF THE RELEASE ### | ||
### - IT ASSUMES THAT THE `build-chocolatey` WORKFLOW WAS EXECUTED BEFORE ### | ||
################################################################################################### | ||
|
||
|
||
name: Publish Scala to Chocolatey | ||
run-name: Publish Scala ${{ inputs.version }} to Chocolatey | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
secrets: | ||
# Connect to https://community.chocolatey.org/profiles/scala | ||
# Accessible via https://community.chocolatey.org/account | ||
API-KEY: | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Fetch the Chocolatey package from GitHub | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: scala.nupkg | ||
- name: Publish the package to Chocolatey | ||
run: choco push scala.nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.API-KEY }} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
################################################################################################### | ||
### THIS IS A REUSABLE WORKFLOW TO TEST SCALA WITH CHOCOLATEY ### | ||
### HOW TO USE: ### | ||
### ### | ||
### NOTE: ### | ||
### ### | ||
################################################################################################### | ||
|
||
name: Test 'scala' Chocolatey Package | ||
run-name: Test 'scala' (${{ inputs.version }}) Chocolatey Package | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
java-version: | ||
required: true | ||
type : string | ||
|
||
env: | ||
CHOCOLATEY-REPOSITORY: chocolatey-pkgs | ||
DOTTY_CI_INSTALLATION: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
test: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: ${{ inputs.java-version }} | ||
- name: Download the 'nupkg' from GitHub Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: scala.nupkg | ||
path: ${{ env.CHOCOLATEY-REPOSITORY }} | ||
- name : Install the `scala` package with Chocolatey | ||
run : choco install scala --source "${{ env.CHOCOLATEY-REPOSITORY }}" --pre # --pre since we might be testing non-stable releases | ||
shell: pwsh | ||
- name : Test the `scala` command | ||
run : scala --version | ||
shell: pwsh | ||
- name : Test the `scalac` command | ||
run : scalac --version | ||
- name : Test the `scaladoc` command | ||
run : scaladoc --version | ||
- name : Uninstall the `scala` package | ||
run : choco uninstall scala | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uuh, this should be dropped actually and merged with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<h1 align=center>Configuration for Chocolatey</h1> | ||
|
||
Official support for Chocolatey started by the release of Scala 3.6.0 | ||
|
||
> [!IMPORTANT] | ||
> This folder contains the templates to generate the configuration for Chocolatey. | ||
> The `scala.nuspec` and `chocolateyInstall.ps1` files needs to be rewritten by changing the following placeholders: | ||
> - @LAUNCHER_VERSION@ : Placeholder for the current scala version to deploy | ||
> - @LAUNCHER_URL@ : Placeholder for the URL to the windows zip released on GitHub | ||
> - @LAUNCHER_SHA256@ : Placeholder for the SHA256 of the msi file released on GitHub | ||
|
||
## Important information | ||
|
||
- How to create a *Chocolatey* package: https://docs.chocolatey.org/en-us/create/create-packages/ | ||
- Guidelines to follow for the package icon: https://docs.chocolatey.org/en-us/create/create-packages/#package-icon-guidelines | ||
- `.nuspec` format specification: https://learn.microsoft.com/en-gb/nuget/reference/nuspec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h1 align=center>Configuration for Chocolatey</h1> | ||
|
||
Official support for Chocolatey started by the release of Scala 3.6.0 | ||
|
||
> [!IMPORTANT] | ||
> This folder contains the templates to generate the configuration for Chocolatey. | ||
> The `scala.nuspec` and `chocolateyInstall.ps1` files needs to be rewritten by changing the following placeholders: | ||
> - @LAUNCHER_VERSION@ : Placeholder for the current scala version to deploy | ||
> - @LAUNCHER_URL@ : Placeholder for the URL to the windows zip released on GitHub | ||
> - @LAUNCHER_SHA256@ : Placeholder for the SHA256 of the msi file released on GitHub |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>scala</id> | ||
<version>@LAUNCHER_VERSION@</version> | ||
<title>Scala</title> | ||
<authors>scala</authors> | ||
<owners>scala</owners> | ||
<tags>scala</tags> | ||
<summary>Scala</summary> | ||
<description>Official release of the Scala Programming Language on Chocolatey.</description> | ||
<packageSourceUrl>https://github.com/scala/scala3/tree/main/pkgs/chocolatey</packageSourceUrl> | ||
<projectSourceUrl>https://github.com/scala/scala3</projectSourceUrl> | ||
<projectUrl>https://scala-lang.org/</projectUrl> | ||
<bugTrackerUrl>https://github.com/scala/scala3/issues</bugTrackerUrl> | ||
<copyright>© 2002-2024, LAMP/EPFL</copyright> | ||
<iconUrl>https://cdn.jsdelivr.net/gh/scala/scala3@a046b0014ffd9536144d67a48f8759901b96d12f/pkgs/chocolatey/icon.svg</iconUrl> | ||
<licenseUrl>https://github.com/scala/scala3/blob/main/LICENSE</licenseUrl> | ||
<requireLicenseAcceptance>true</requireLicenseAcceptance> | ||
<releaseNotes>https://github.com/scala/scala3/releases</releaseNotes> | ||
</metadata> | ||
<files> | ||
<file src="tools\**" target="tools" /> | ||
</files> | ||
</package> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.