-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,40 @@ | ||
name: Release | ||
name: release | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Test"] | ||
types: | ||
- completed | ||
create: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
build-and-release: | ||
if: github.event.workflow_run.conclusion == 'success' | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: "go.mod" | ||
|
||
- name: Build | ||
run: go build -v -o ./bin/ ./... | ||
|
||
- name: Create Release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
files: | | ||
Release.txt | ||
LICENSE | ||
./bin/prometheus-cve-exporter | ||
- name: Upload to GitHub Packages | ||
uses: actions/upload-artifact@v4 | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
name: prometheus-cve-exporter | ||
path: ./bin/prometheus-cve-exporter | ||
distribution: goreleaser | ||
# 'latest', 'nightly', or a semver | ||
version: "~> v1" | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Test | ||
|
||
on: | ||
workflow_call: | ||
push: | ||
branches: | ||
- main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
project_name: prometheus-cve-exporter | ||
builds: | ||
- env: [CGO_ENABLED=0] | ||
main: ./cmd/prometheus-cve-exporter | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
dockers: | ||
- image_templates: | ||
- "ghcr.io/zadjadr/prometheus-cve-exporter:{{ .Tag }}" | ||
- "ghcr.io/zadjadr/prometheus-cve-exporter:v{{ .Major }}" | ||
- "ghcr.io/zadjadr/prometheus-cve-exporter:v{{ .Major }}.{{ .Minor }}" | ||
- "ghcr.io/zadjadr/prometheus-cve-exporter:latest" | ||
dockerfile: Dockerfile | ||
build_flag_templates: | ||
- --label=org.opencontainers.image.title={{ .ProjectName }} | ||
- --label=org.opencontainers.image.description="Prometheus CVE Exporter is a Golang application that scans your system for all installed packages and compares them with the recent NVD JSON feed. It exports metrics that provide insights into the security status of your packages." | ||
- --label=org.opencontainers.image.url=https://github.com/zadjadr/prometheus-cve-exporter | ||
- --label=org.opencontainers.image.source=https://github.com/zadjadr/prometheus-cve-exporter | ||
- --label=org.opencontainers.image.version=v{{ .Major }}.{{ .Minor }}" | ||
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} | ||
- --label=org.opencontainers.image.revision={{ .FullCommit }} | ||
- --label=org.opencontainers.image.licenses=MIT | ||
nfpms: | ||
- maintainer: Zadjad Rezai <[email protected]> | ||
description: Prometheus CVE Exporter is a Golang application that scans your system for all installed packages and compares them with the recent NVD JSON feed. It exports metrics that provide insights into the security status of your packages. | ||
homepage: https://github.com/zadjadr/prometheus-cve-exporter | ||
license: MIT | ||
formats: | ||
- deb | ||
- rpm | ||
- apk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY prometheus-cve-exporter /usr/bin/prometheus-cve-exporter | ||
ENTRYPOINT ["/usr/bin/prometheus-cve-exporter"] |