Skip to content

Commit c642d40

Browse files
chore(ci): add job to push new version to chocolatey
1 parent 6761a1e commit c642d40

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

.github/workflows/tag.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,23 @@ jobs:
175175
scripts/push-to-cloudsmith
176176
env:
177177
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
178+
179+
push_to_chocolatey:
180+
needs: build_release_assets
181+
name: Push to Chocolatey
182+
runs-on: chocolatey/choco
183+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
184+
steps:
185+
- name: Checkout
186+
uses: actions/checkout@v4
187+
188+
- name: Download packages
189+
uses: actions/download-artifact@v4
190+
with:
191+
pattern: os-packages-windows-2022
192+
path: packages
193+
merge-multiple: true
194+
195+
- name: Push to Chocolatey
196+
run: |
197+
scripts/push-to-chocolatey/push-to-chocolatey
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Added
2+
3+
- GGShield is now available on Chocolatey (934).
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
3+
<metadata>
4+
<id>ggshield</id>
5+
<version>__VERSION__</version>
6+
<owners>GitGuardian</owners>
7+
<title>GGShield</title>
8+
<authors>GitGuardian</authors>
9+
<projectUrl>https://github.com/GitGuardian/ggshield</projectUrl>
10+
<iconUrl>https://avatars.githubusercontent.com/u/27360172</iconUrl>
11+
<licenseUrl>https://raw.githubusercontent.com/GitGuardian/ggshield/refs/heads/main/LICENSE</licenseUrl>
12+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13+
<projectSourceUrl>https://github.com/GitGuardian/ggshield</projectSourceUrl>
14+
<docsUrl>https://docs.gitguardian.com/ggshield-docs/getting-started</docsUrl>
15+
<tags>ggshield</tags>
16+
<summary>ggshield is a CLI application that helps you detect secrets.</summary>
17+
<description>
18+
ggshield is a CLI application that runs in your local environment or in a CI environment to help you detect more than 400+ types of secrets.
19+
20+
ggshield is open source on GitHub and accessible [here](https://github.com/GitGuardian/ggshield).
21+
22+
ggshield can run:
23+
24+
- in your local environment to scan local files and repositories or as a pre-commit hook.
25+
- in a CI environment,
26+
- in a pre-receive hook, if you have a self-managed VCS instance
27+
28+
Note: ggshield uses our public API through py-gitguardian to scan files. Only metadata such as call time, request size and scan mode is stored when launching a scan with ggshield, therefore secrets incidents will not be displayed on your dashboard and your files and secrets won't be stored.
29+
</description>
30+
<releaseNotes>https://raw.githubusercontent.com/GitGuardian/ggshield/refs/heads/main/CHANGELOG.md</releaseNotes>
31+
</metadata>
32+
<files>
33+
<file src="tools\**" target="tools" />
34+
</files>
35+
</package>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
die() {
5+
echo $* >&2
6+
exit 1
7+
}
8+
9+
if [ -z "${CHOCOLATEY_API_KEY:-}" ] ; then
10+
die '$CHOCOLATEY_API_KEY is not set'
11+
fi
12+
13+
if ! command -v unzip > /dev/null ; then
14+
apt update
15+
apt install unzip
16+
fi
17+
18+
zip_name=$(ls packages)
19+
unzip packages/$zip_name -d packages
20+
21+
version=$(echo "$zip_name" | grep -oP '(?<=ggshield-)[0-9.]+')
22+
23+
mkdir ggshield-package
24+
mkdir ggshield-package/tools
25+
26+
mv packages/*/_internal ggshield-package/tools
27+
mv packages/*/ggshield.exe ggshield-package/tools
28+
cp scripts/push-to-chocolatey/ggshield.nuspec ggshield-package
29+
sed -i "s/__VERSION__/$version/" ggshield-package/ggshield.nuspec
30+
31+
cd ggshield-package
32+
choco pack
33+
34+
choco push ggshield.$version.nupkg --source https://push.chocolatey.org/ --api-key $CHOCOLATEY_API_KEY

0 commit comments

Comments
 (0)