-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adapt the workflow to release on SDKMAN! #20535
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
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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,69 @@ | ||
################################################################################################### | ||
### THIS IS A REUSABLE WORKFLOW TO PUBLISH SCALA TO SDKMAN! ### | ||
### HOW TO USE: ### | ||
### - THE RELEASE WORKFLOW SHOULD CALL THIS WORKFLOW ### | ||
### - IT WILL PUBLISH TO SDKMAN! THE BINARIES TO EACH SUPPORTED PLATFORM AND A UNIVERSAL JAR ### | ||
### - IT CHANGES THE DEFAULT VERSION IN SDKMAN! ### | ||
### ### | ||
### NOTE: ### | ||
### - WE SHOULD KEEP IN SYNC THE NAME OF THE ARCHIVES WITH THE ACTUAL BUILD ### | ||
### - WE SHOULD KEEP IN SYNC THE URL OF THE RELEASE ### | ||
################################################################################################### | ||
|
||
|
||
name: Publish Scala to SDKMAN! | ||
run-name: Publish Scala ${{ inputs.version }} to SDKMAN! | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
secrets: | ||
CONSUMER-KEY: | ||
required: true | ||
CONSUMER-TOKEN: | ||
required: true | ||
|
||
env: | ||
RELEASE-URL: 'https://github.com/scala/scala3/releases/download/${{ inputs.version }}' | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- platform: LINUX_64 | ||
archive : 'scala3-${{ inputs.version }}-x86_64-pc-linux.tar.gz' | ||
- platform: LINUX_ARM64 | ||
archive : 'scala3-${{ inputs.version }}-aarch64-pc-linux.tar.gz' | ||
- platform: MAC_OSX | ||
archive : 'scala3-${{ inputs.version }}-x86_64-apple-darwin.tar.gz' | ||
- platform: MAC_ARM64 | ||
archive : 'scala3-${{ inputs.version }}-aarch64-apple-darwin.tar.gz' | ||
- platform: WINDOWS_64 | ||
archive : 'scala3-${{ inputs.version }}-x86_64-pc-win32.tar.gz' | ||
- platform: UNIVERSAL | ||
archive : 'scala3-${{ inputs.version }}.zip' | ||
steps: | ||
- uses: hamzaremmal/sdkman-release-action@main # TODO: Make a release of the action and configure the version here | ||
with: | ||
CONSUMER-KEY : ${{ secrets.CONSUMER-KEY }} | ||
CONSUMER-TOKEN : ${{ secrets.CONSUMER-TOKEN }} | ||
CANDIDATE : scala | ||
VERSION : ${{ inputs.version }} | ||
URL : '${{ env.RELEASE-URL }}/${{ matrix.archive }}' | ||
PLATFORM : ${{ matrix.platform }} | ||
|
||
default: | ||
runs-on: ubuntu-latest | ||
needs: publish | ||
steps: | ||
- uses: hamzaremmal/sdkman-default-action@main # TODO: Make a release of the action and configure the version here | ||
with: | ||
CONSUMER-KEY : ${{ secrets.CONSUMER-KEY }} | ||
CONSUMER-TOKEN : ${{ secrets.CONSUMER-TOKEN }} | ||
CANDIDATE : scala | ||
VERSION : ${{ inputs.version }} |
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 |
---|---|---|
@@ -1,32 +1,33 @@ | ||
name: Releases | ||
################################################################################################### | ||
### OFFICIAL RELEASE WORKFLOW ### | ||
### HOW TO USE: ### | ||
### - THIS WORKFLOW WILL NEED TO BE TRIGGERED MANUALLY ### | ||
### ### | ||
### NOTE: ### | ||
### - THIS WORKFLOW SHOULD ONLY BE RUN ON STABLE RELEASES ### | ||
### - IT ASSUMES THAT THE PRE-RELEASE WORKFLOW WAS PREVIOUSLY EXECUTED ### | ||
### ### | ||
################################################################################################### | ||
|
||
name: Official release of Scala | ||
run-name: Official release of Scala ${{ inputs.version }} | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
inputs: | ||
version: | ||
description: 'The version to officially release' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
publish_release: | ||
runs-on: [self-hosted, Linux] | ||
container: | ||
image: lampepfl/dotty:2021-03-22 | ||
options: --cpu-shares 4096 | ||
|
||
env: | ||
SDKMAN_KEY: ${{ secrets.SDKMAN_KEY }} | ||
SDKMAN_TOKEN: ${{ secrets.SDKMAN_TOKEN }} | ||
|
||
steps: | ||
- name: Reset existing repo | ||
run: | | ||
git config --global --add safe.directory /__w/dotty/dotty | ||
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/lampepfl/dotty" && git reset --hard FETCH_HEAD || true | ||
|
||
- name: Cleanup | ||
run: .github/workflows/cleanup.sh | ||
|
||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Publish to SDKMAN | ||
run: .github/workflows/scripts/publish-sdkman.sh | ||
# 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 }} | ||
|
||
# TODO: ADD RELEASE WORKFLOW TO CHOCOLATEY AND OTHER PACKAGE MANAGERS HERE |
This file was deleted.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any estimate of how much effort would take to make a release for these actions? I'm mostly sceptical about using a main branch directly as it's fragile to any changes.
A tag (preferred if possible) or even a commit pointing to well known revision might be a better idea and might prevent getting any unexpected changes in these workflows when publishing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not much actually, I just have to write the documentation for it and ask the author of sdkman about the body of the reponse to parse it to extract them as outputs. (See
action.yml
). In all cases, this action is fully working but I don't have the time at the moment to polish these details.Agreed, I will update these to use the commit instead of the branch.