Skip to content

Commit

Permalink
move to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
czerwonk committed Jul 20, 2021
1 parent 35a6ba0 commit fb4722d
Show file tree
Hide file tree
Showing 9 changed files with 461 additions and 78 deletions.
9 changes: 0 additions & 9 deletions .circleci/config.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/docker_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
workflow_run:
workflows: ["Test"]
branches: [master]
types:
- completed

name: Docker Build (latest)
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Check Out Repo
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Extract repo name
id: extract_repo_name
shell: bash
run: echo "##[set-output name=repo;]$(echo ${GITHUB_REPOSITORY#*/})"

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: mauvesoftware/${{ steps.extract_repo_name.outputs.repo }}:latest

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
45 changes: 45 additions & 0 deletions .github/workflows/docker_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
push:
tags:
- '*.*.*'

name: Docker Build (tag)
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check Out Repo
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Extract repo name
id: extract_repo_name
shell: bash
run: echo "##[set-output name=repo;]$(echo ${GITHUB_REPOSITORY#*/})"

- name: Extract tag name
id: extract_tag_name
shell: bash
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/})"

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: mauvesoftware/${{ steps.extract_repo_name.outputs.repo }}:v${{ steps.extract_tag_name.outputs.tag }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
tags:
- '*.*.*'

name: Release
jobs:
goreleaser:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.16.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: go build
- name: Run tests
run: go test ./... -v -covermode=count
20 changes: 20 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
dist: artifacts
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- freebsd
goarch:
- amd64
- arm
- arm64
ignore:
- goos: freebsd
goarch: arm64
ldflags: -s -w -X main.version={{.Version}}
binary: flan_exporter
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[![CircleCI](https://circleci.com/gh/MauveSoftware/flan_exporter.svg?style=shield)](https://circleci.com/gh/MauveSoftware/flan_exporter)
[![Go Report Card](https://goreportcard.com/badge/github.com/mauvesoftware/flan_exporter)](https://goreportcard.com/report/github.com/mauvesoftware/flan_exporter)
[![Docker Build Status](https://img.shields.io/docker/cloud/build/mauvesoftware/flan_exporter.svg)](https://hub.docker.com/r/mauvesoftware/flan_exporter/builds)

# flan_exporter
Metrics exporter for Cloudflares Flan Scan vulnerability / network scanner

Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/MauveSoftware/flan_exporter

go 1.14
go 1.16

require (
cloud.google.com/go/storage v1.6.0
cloud.google.com/go/storage v1.16.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.5.1
github.com/sirupsen/logrus v1.5.0
google.golang.org/api v0.21.0
github.com/prometheus/client_golang v1.11.0
github.com/sirupsen/logrus v1.8.1
google.golang.org/api v0.50.0
)
Loading

0 comments on commit fb4722d

Please sign in to comment.