Skip to content

Commit

Permalink
install CI/CD auto-release, bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
psycofdj committed Jan 25, 2021
1 parent 46196ad commit 5e4f394
Show file tree
Hide file tree
Showing 225 changed files with 8,379 additions and 4,907 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: build-and-release

on:
push:
# not not consider simplec commit
branches:
- '!*'
# consider only release and pre-release tags
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: set up go
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: cache go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: tests modules
run: |
go mod vendor
if [ ! -z "$(git status --porcelain)" ]; then
echo "::error::vendor directory if not synched with go.mod, please run go mod vendor"
exit 1
fi
go mod tidy
if [ ! -z "$(git status --porcelain)" ]; then
echo "::error::modules are not tidy, please run go mod tidy"
exit 1
fi
- name: tests
run: |
go test -v ./...
- name: run goreleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USER: github-actions
78 changes: 41 additions & 37 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# you may remove this if you don't use vgo
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
project_name: credhub_exporter

builds:
- goos:
- linux
- darwin
-
&template
id: binary
binary: credhub_exporter
env:
- CGO_ENABLED=0
ldflags:
- -s -w
- -s
- -w
- -X github.com/prometheus/common/version.Version={{.Version}}
- -X github.com/prometheus/common/version.Revision={{.Commit}}
- -X github.com/prometheus/common/version.Branch=master
- -X github.com/prometheus/common/version.BuildDate={{.Date}}
- -X github.com/prometheus/common/version.Revision={{.FullCommit}}
- -X github.com/prometheus/common/version.Branch={{.Branch}}
- -X github.com/prometheus/common/version.BuildUser={{.Env.USER}}
- -X github.com/prometheus/common/version.BuildDate={{.Date}}
goos:
- linux
- darwin
goarch:
- amd64
env:
- CGO_ENABLED=0
id: binary
main: .
binary: credhub_exporter

archives:
- id: zip-archive-provider
builds: [binary]
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}"
format: zip
- id: binary-archive-provider
builds: [binary]
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}"
format: binary
- id: archives
builds:
- binary
format: "tar.gz"
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
wrap_in_directory: true
files:
- LICENSE*
- README*
- CHANGELOG*
- docs/*
- assets/*
- static/*
- templates/*

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
name_template: checksums.txt
algorithm: sha256

release:
github:
owner: orange-cloudfoundry
name: credhub_exporter
prerelease: auto
name_template: '{{.Tag}}'
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ module github.com/orange-cloudfoundry/credhub_exporter
go 1.15

require (
code.cloudfoundry.org/credhub-cli v0.0.0-20201005130041-1bceca68b93b
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/common v0.14.0
github.com/prometheus/procfs v0.2.0 // indirect
code.cloudfoundry.org/credhub-cli v0.0.0-20210125140101-1798ce98e3c0
github.com/alecthomas/units v0.0.0-20201120081800-1786d5ef83d4 // indirect
github.com/prometheus/client_golang v1.9.0
github.com/prometheus/common v0.15.0
github.com/prometheus/procfs v0.3.0 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0 // indirect
golang.org/x/sys v0.0.0-20201007082116-8445cc04cbdf // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6
)
Loading

0 comments on commit 5e4f394

Please sign in to comment.