Skip to content

Commit 0e8f012

Browse files
committed
Finish the GitHub workflow
1 parent 2af3adb commit 0e8f012

File tree

5 files changed

+48
-13
lines changed

5 files changed

+48
-13
lines changed

.github/workflows/publish-chocolatey.yml

+40-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
### - WE SHOULD KEEP IN SYNC THE URL OF THE RELEASE ###
1010
###################################################################################################
1111

12-
1312
name: Publish Scala to Chocolatey
1413
run-name: Publish Scala ${{ inputs.version }} to Chocolatey
1514

@@ -33,10 +32,47 @@ jobs:
3332
build:
3433
runs-on: windows-latest
3534
steps:
36-
- run: echo hello world # TODO: ACTUALLY BUILD THE .nupkg
35+
- name: Check the version of Chocolatey
36+
run : choco --version
37+
- name: Replace the version placeholder
38+
uses: richardrigutins/replace-in-files@v2
39+
with:
40+
files: ./pkgs/chocolatey/scala.nuspec
41+
search-text: '@LAUNCHER_VERSION@'
42+
replacement-text: ${{ inputs.version }}
43+
- name: Replace the URL placeholder
44+
uses: richardrigutins/replace-in-files@v2
45+
with:
46+
files: ./pkgs/chocolatey/tools/chocolateyinstall.ps1
47+
search-text: '@LAUNCHER_URL@'
48+
replacement-text: ${{ env.RELEASE-URL }}/${{ env.MSI_FILE }}
49+
- name: Build the Chocolatey package (.nupkg)
50+
run : choco --pack ./pkgs/chocolatey/scala.nuspec --outputdirectory ./pkgs/chocolatey
51+
- name: Upload the Chocolatey package to GitHub
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: scala.nupkg
55+
path: ./pkgs/chocolatey/scala.nupkg
56+
if-no-files-found: error
3757

38-
publish:
58+
test:
3959
runs-on: windows-latest
4060
needs: build
4161
steps:
42-
- run: echo hello world # TODO: ACTUALLY PUBLISH THE PACKAGE
62+
- name: Fetch the Chocolatey package from GitHub
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: scala.nupkg
66+
- name: Try to install the package locally
67+
run: choco install scala --debug --verbose --source .
68+
69+
publish:
70+
runs-on: windows-latest
71+
needs: [build, test]
72+
steps:
73+
- name: Fetch the Chocolatey package from GitHub
74+
uses: actions/download-artifact@v4
75+
with:
76+
name: scala.nupkg
77+
- name: Publish the package to Chocolatey
78+
run: choco push scala.nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.API-KEY }}

pkgs/README.md

-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@
33
The following folder contains the configuration files of all the package managers under the control of the scala organisation.
44

55
- [chocolatey](chocolatey): Configuration files for Chocolatey
6-
7-
## Important information
8-
9-
- Guidelines to follow for the package icon: https://docs.chocolatey.org/en-us/create/create-packages/#package-icon-guidelines

pkgs/chocolatey/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@ Official support for Chocolatey started by the release of Scala 3.5.0
77
> The `scala.nuspec` and `chocolateyinstall.ps1` files needs to be rewritten by changing the following placeholders:
88
> - @LAUNCHER_VERSION@ : Placeholder for the current scala version to deploy
99
> - @LAUNCHER_URL@ : Placeholder for the URL to the msi released on GitHub
10-
> - @LAUNCHER_SHA256@ : Placeholder for the SHA256 of the msi file released on GitHub
10+
11+
## Important information
12+
13+
- How to create a *Chocolatey* package: https://docs.chocolatey.org/en-us/create/create-packages/
14+
- Guidelines to follow for the package icon: https://docs.chocolatey.org/en-us/create/create-packages/#package-icon-guidelines
15+
- `.nuspec` format specification: https://learn.microsoft.com/en-gb/nuget/reference/nuspec

pkgs/chocolatey/tools/chocolateyUninstall.ps1

Whitespace-only changes.

pkgs/chocolatey/tools/chocolateyinstall.ps1

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
$ErrorActionPreference = 'Stop';
22
$packageArgs = @{
33
packageName = 'scala'
4-
fileType = 'MSI'
4+
fileType = 'msi'
55
url64bit = '@LAUNCHER_URL@'
66

7-
softwareName = 'Scala'
8-
checksum64 = '@LAUNCHER_SHA256@'
9-
checksumType64= 'sha256'
7+
softwareName = 'Scala'
108

119
silentArgs = "/qn /norestart"
1210
validExitCodes= @(0)

0 commit comments

Comments
 (0)