Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use gh actions for testing, releasing #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions .drone.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: build
on: [
push,
pull_request
]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
- name: Checkout code
uses: actions/checkout@v2
- name: build
run: |
make build
make test
make vet
make lint
24 changes: 24 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: GoReleaser
on:
workflow_run:
workflows: ["Bump Git/Docker Version"]
branches: [master]
types:
- completed
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Install Go
uses: actions/setup-go@v2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bump Git/Docker Version
on:
push:
branches:
- master

jobs:
semver:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tagging.outputs.new_tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.39.0
id: tagging
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
RELEASE_BRANCHES: master
DEFAULT_BUMP: minor
docker:
runs-on: ubuntu-latest
needs: semver
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
- name: Build and push latest
id: docker_build_latest
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ github.repository }}:latest
- name: Build and push versioned
id: docker_build_versioned
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ github.repository }}:${{ needs.semver.outputs.tag }}
27 changes: 27 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
before:
hooks:
- go mod tidy
builds:
- env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like Terraform Cloud where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.Version={{.Version}} -X main.Commit={{.Commit}}'
goos:
- linux
goarch:
- amd64
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: binary
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
changelog:
skip: false
sort: asc
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ To deploy directly onto digitalocean, click the button below.
#### Docker

```bash
docker pull metalmatze/digitalocean_exporter:0.6.1
docker run --rm -p 9212:9212 -e DIGITALOCEAN_TOKEN=XXX metalmatze/digitalocean_exporter:0.6.1
docker run --rm -p 9212:9212 -e DIGITALOCEAN_TOKEN=XXX metalmatze/digitalocean_exporter
```

Example `docker-compose.yml` with Transmission also running in docker.

```yaml
digitalocean_exporter:
image: metalmatze/digitalocean_exporter:0.6.1
image: metalmatze/digitalocean_exporter
environment:
- '-do.token=XXX'
restart: always
Expand Down