readme: Integrate CI badges #1
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
name: Release | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
create: | |
tags: | |
- "v*.*.*" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- name: Install dependencies | |
run: go mod download | |
- name: Run linter | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
- name: Run tests | |
run: go test -v ./... | |
build-and-release: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
Release.txt | |
LICENSE | |
./bin/prometheus-cve-exporter | |
- name: Upload to GitHub Packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: prometheus-cve-exporter | |
path: ./bin/prometheus-cve-exporter |