Skip to content

Commit

Permalink
ci: add gpg signing for RPM packages (#3612)
Browse files Browse the repository at this point in the history
  • Loading branch information
afdesk committed Mar 24, 2023
1 parent e76d5ff commit 67572df
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/reusable-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,25 @@ jobs:
args: mod -licenses -json -output bom.json
version: ^v1

- name: "save gpg key"
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
run: |
echo "$GPG_KEY" > gpg.txt
- name: GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: v1.4.1
args: release -f=${{ inputs.goreleaser_config}} ${{ inputs.goreleaser_options}}
env:
GITHUB_TOKEN: ${{ secrets.ORG_REPO_TOKEN }}
NFPM_DEFAULT_RPM_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_FILE: "gpg.txt"

- name: "remove gpg key"
run: |
rm gpg.txt
## push images to registries
## only for canary build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,5 @@ jobs:
with:
version: v1.4.1
args: release --skip-sign --snapshot --rm-dist --skip-publish --timeout 90m

env:
GPG_FILE: "nofile"
3 changes: 2 additions & 1 deletion docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ In this section you will find an aggregation of the different ways to install Tr
[trivy]
name=Trivy repository
baseurl=https://aquasecurity.github.io/trivy-repo/rpm/releases/$RELEASE_VERSION/\$basearch/
gpgcheck=0
gpgcheck=1
enabled=1
gpgkey=https://aquasecurity.github.io/trivy-repo/rpm/public.key
EOF
sudo yum -y update
sudo yum -y install trivy
Expand Down
3 changes: 3 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ nfpms:
contents:
- src: contrib/*.tpl
dst: /usr/local/share/trivy/templates
rpm:
signature:
key_file: '{{ .Env.GPG_FILE }}'

archives:
-
Expand Down

0 comments on commit 67572df

Please sign in to comment.