Skip to content

Commit

Permalink
Adapt the workflow to release on SDKMAN! (#20535)
Browse files Browse the repository at this point in the history
Adapts the workflow to the changes in #20351
  • Loading branch information
hamzaremmal authored Jun 15, 2024
2 parents fcb0a3f + 550a960 commit 48a823f
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 78 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/publish-sdkman.yml
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@7e437233a6bd79bc4cb0fa9071b685e94bdfdba6
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@866bc79fc5bd397eeb48f9cedda2f15221c8515d
with:
CONSUMER-KEY : ${{ secrets.CONSUMER-KEY }}
CONSUMER-TOKEN : ${{ secrets.CONSUMER-TOKEN }}
CANDIDATE : scala
VERSION : ${{ inputs.version }}
57 changes: 29 additions & 28 deletions .github/workflows/releases.yml
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
50 changes: 0 additions & 50 deletions .github/workflows/scripts/publish-sdkman.sh

This file was deleted.

0 comments on commit 48a823f

Please sign in to comment.