Skip to content

Commit 48a823f

Browse files
authored
Adapt the workflow to release on SDKMAN! (#20535)
Adapts the workflow to the changes in #20351
2 parents fcb0a3f + 550a960 commit 48a823f

File tree

3 files changed

+98
-78
lines changed

3 files changed

+98
-78
lines changed

Diff for: .github/workflows/publish-sdkman.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
###################################################################################################
2+
### THIS IS A REUSABLE WORKFLOW TO PUBLISH SCALA TO SDKMAN! ###
3+
### HOW TO USE: ###
4+
### - THE RELEASE WORKFLOW SHOULD CALL THIS WORKFLOW ###
5+
### - IT WILL PUBLISH TO SDKMAN! THE BINARIES TO EACH SUPPORTED PLATFORM AND A UNIVERSAL JAR ###
6+
### - IT CHANGES THE DEFAULT VERSION IN SDKMAN! ###
7+
### ###
8+
### NOTE: ###
9+
### - WE SHOULD KEEP IN SYNC THE NAME OF THE ARCHIVES WITH THE ACTUAL BUILD ###
10+
### - WE SHOULD KEEP IN SYNC THE URL OF THE RELEASE ###
11+
###################################################################################################
12+
13+
14+
name: Publish Scala to SDKMAN!
15+
run-name: Publish Scala ${{ inputs.version }} to SDKMAN!
16+
17+
on:
18+
workflow_call:
19+
inputs:
20+
version:
21+
required: true
22+
type: string
23+
secrets:
24+
CONSUMER-KEY:
25+
required: true
26+
CONSUMER-TOKEN:
27+
required: true
28+
29+
env:
30+
RELEASE-URL: 'https://github.com/scala/scala3/releases/download/${{ inputs.version }}'
31+
32+
jobs:
33+
publish:
34+
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
include:
38+
- platform: LINUX_64
39+
archive : 'scala3-${{ inputs.version }}-x86_64-pc-linux.tar.gz'
40+
- platform: LINUX_ARM64
41+
archive : 'scala3-${{ inputs.version }}-aarch64-pc-linux.tar.gz'
42+
- platform: MAC_OSX
43+
archive : 'scala3-${{ inputs.version }}-x86_64-apple-darwin.tar.gz'
44+
- platform: MAC_ARM64
45+
archive : 'scala3-${{ inputs.version }}-aarch64-apple-darwin.tar.gz'
46+
- platform: WINDOWS_64
47+
archive : 'scala3-${{ inputs.version }}-x86_64-pc-win32.tar.gz'
48+
- platform: UNIVERSAL
49+
archive : 'scala3-${{ inputs.version }}.zip'
50+
steps:
51+
- uses: hamzaremmal/sdkman-release-action@7e437233a6bd79bc4cb0fa9071b685e94bdfdba6
52+
with:
53+
CONSUMER-KEY : ${{ secrets.CONSUMER-KEY }}
54+
CONSUMER-TOKEN : ${{ secrets.CONSUMER-TOKEN }}
55+
CANDIDATE : scala
56+
VERSION : ${{ inputs.version }}
57+
URL : '${{ env.RELEASE-URL }}/${{ matrix.archive }}'
58+
PLATFORM : ${{ matrix.platform }}
59+
60+
default:
61+
runs-on: ubuntu-latest
62+
needs: publish
63+
steps:
64+
- uses: hamzaremmal/sdkman-default-action@866bc79fc5bd397eeb48f9cedda2f15221c8515d
65+
with:
66+
CONSUMER-KEY : ${{ secrets.CONSUMER-KEY }}
67+
CONSUMER-TOKEN : ${{ secrets.CONSUMER-TOKEN }}
68+
CANDIDATE : scala
69+
VERSION : ${{ inputs.version }}

Diff for: .github/workflows/releases.yml

+29-28
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
name: Releases
1+
###################################################################################################
2+
### OFFICIAL RELEASE WORKFLOW ###
3+
### HOW TO USE: ###
4+
### - THIS WORKFLOW WILL NEED TO BE TRIGGERED MANUALLY ###
5+
### ###
6+
### NOTE: ###
7+
### - THIS WORKFLOW SHOULD ONLY BE RUN ON STABLE RELEASES ###
8+
### - IT ASSUMES THAT THE PRE-RELEASE WORKFLOW WAS PREVIOUSLY EXECUTED ###
9+
### ###
10+
###################################################################################################
11+
12+
name: Official release of Scala
13+
run-name: Official release of Scala ${{ inputs.version }}
14+
215
on:
316
workflow_dispatch:
4-
5-
permissions:
6-
contents: read
17+
inputs:
18+
version:
19+
description: 'The version to officially release'
20+
required: true
21+
type: string
722

823
jobs:
9-
publish_release:
10-
runs-on: [self-hosted, Linux]
11-
container:
12-
image: lampepfl/dotty:2021-03-22
13-
options: --cpu-shares 4096
14-
15-
env:
16-
SDKMAN_KEY: ${{ secrets.SDKMAN_KEY }}
17-
SDKMAN_TOKEN: ${{ secrets.SDKMAN_TOKEN }}
18-
19-
steps:
20-
- name: Reset existing repo
21-
run: |
22-
git config --global --add safe.directory /__w/dotty/dotty
23-
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/lampepfl/dotty" && git reset --hard FETCH_HEAD || true
24-
25-
- name: Cleanup
26-
run: .github/workflows/cleanup.sh
27-
28-
- name: Git Checkout
29-
uses: actions/checkout@v4
30-
31-
- name: Publish to SDKMAN
32-
run: .github/workflows/scripts/publish-sdkman.sh
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+
# TODO: ADD RELEASE WORKFLOW TO CHOCOLATEY AND OTHER PACKAGE MANAGERS HERE

Diff for: .github/workflows/scripts/publish-sdkman.sh

-50
This file was deleted.

0 commit comments

Comments
 (0)