99# ## - WE SHOULD KEEP IN SYNC THE URL OF THE RELEASE ###
1010# ##################################################################################################
1111
12-
1312name : Publish Scala to Chocolatey
1413run-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 }}
0 commit comments