Skip to content

Commit

Permalink
ci: add package ci pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjadr committed Jul 14, 2024
1 parent 9c8931c commit ce40e75
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Package

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 ./...

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Release.txt
LICENSE
prometheus-cve-exporter
- name: Upload to GitHub Packages
uses: actions/upload-artifact@v4
with:
name: prometheus-cve-exporter
path: ./prometheus-cve-exporter

0 comments on commit ce40e75

Please sign in to comment.