Skip to content

Commit

Permalink
Finish the GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzaremmal committed Jun 13, 2024
1 parent 4a20661 commit 1f23b0b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
44 changes: 40 additions & 4 deletions .github/workflows/publish-chocolatey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
### - WE SHOULD KEEP IN SYNC THE URL OF THE RELEASE ###
###################################################################################################


name: Publish Scala to Chocolatey
run-name: Publish Scala ${{ inputs.version }} to Chocolatey

Expand All @@ -33,10 +32,47 @@ jobs:
build:
runs-on: windows-latest
steps:
- run: echo hello world # TODO: ACTUALLY BUILD THE .nupkg
- name: Check the version of Chocolatey
run : choco --version
- name: Replace the version placeholder
uses: richardrigutins/replace-in-files@v2
with:
files: ./pkgs/chocolatey/scala.nuspec
search-text: '@LAUNCHER_VERSION@'
replacement-text: ${{ inputs.version }}
- name: Replace the URL placeholder
uses: richardrigutins/replace-in-files@v2
with:
files: ./pkgs/chocolatey/tools/chocolateyinstall.ps1
search-text: '@LAUNCHER_URL@'
replacement-text: ${{ env.RELEASE-URL }}/${{ env.MSI_FILE }}
- name: Build the Chocolatey package (.nupkg)
run : choco --pack ./pkgs/chocolatey/scala.nuspec --outputdirectory ./pkgs/chocolatey
- name: Upload the Chocolatey package to GitHub
uses: actions/upload-artifact@v4
with:
name: scala.nupkg
path: ./pkgs/chocolatey/scala.nupkg
if-no-files-found: error

publish:
test:
runs-on: windows-latest
needs: build
steps:
- run: echo hello world # TODO: ACTUALLY PUBLISH THE PACKAGE
- name: Fetch the Chocolatey package from GitHub
uses: actions/download-artifact@v4
with:
name: scala.nupkg
- name: Try to install the package locally
run: choco install scala --debug --verbose --source .

publish:
runs-on: windows-latest
needs: [build, test]
steps:
- name: Fetch the Chocolatey package from GitHub
uses: actions/download-artifact@v4
with:
name: scala.nupkg
- name: Publish the package to Chocolatey
run: choco push scala.nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.API-KEY }}
4 changes: 0 additions & 4 deletions pkgs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@
The following folder contains the configuration files of all the package managers under the control of the scala organisation.

- [chocolatey](chocolatey): Configuration files for Chocolatey

## Important information

- Guidelines to follow for the package icon: https://docs.chocolatey.org/en-us/create/create-packages/#package-icon-guidelines
7 changes: 6 additions & 1 deletion pkgs/chocolatey/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ Official support for Chocolatey started by the release of Scala 3.5.0
> The `scala.nuspec` and `chocolateyinstall.ps1` files needs to be rewritten by changing the following placeholders:
> - @LAUNCHER_VERSION@ : Placeholder for the current scala version to deploy
> - @LAUNCHER_URL@ : Placeholder for the URL to the msi released on GitHub
> - @LAUNCHER_SHA256@ : Placeholder for the SHA256 of the msi file released on GitHub
## Important information

- How to create a *Chocolatey* package: https://docs.chocolatey.org/en-us/create/create-packages/
- Guidelines to follow for the package icon: https://docs.chocolatey.org/en-us/create/create-packages/#package-icon-guidelines
- `.nuspec` format specification: https://learn.microsoft.com/en-gb/nuget/reference/nuspec
Empty file.
6 changes: 2 additions & 4 deletions pkgs/chocolatey/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
$ErrorActionPreference = 'Stop';
$packageArgs = @{
packageName = 'scala'
fileType = 'MSI'
fileType = 'msi'
url64bit = '@LAUNCHER_URL@'

softwareName = 'Scala'
checksum64 = '@LAUNCHER_SHA256@'
checksumType64= 'sha256'
softwareName = 'Scala'

silentArgs = "/qn /norestart"
validExitCodes= @(0)
Expand Down

0 comments on commit 1f23b0b

Please sign in to comment.