Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from lukibahr/bump/versions
Bump/versions
- Loading branch information
Showing
16 changed files
with
478 additions
and
689 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
root = "." | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
bin = "./tmp/main" | ||
cmd = "go build -o ./tmp/main ." | ||
delay = 1000 | ||
exclude_dir = ["assets", "tmp", "vendor"] | ||
exclude_file = [] | ||
exclude_regex = [] | ||
exclude_unchanged = false | ||
follow_symlink = false | ||
full_bin = "" | ||
include_dir = [] | ||
include_ext = ["go", "tpl", "tmpl", "html"] | ||
kill_delay = "0s" | ||
log = "build-errors.log" | ||
send_interrupt = false | ||
stop_on_error = true | ||
|
||
[color] | ||
app = "" | ||
build = "yellow" | ||
main = "magenta" | ||
runner = "green" | ||
watcher = "cyan" | ||
|
||
[log] | ||
time = false | ||
|
||
[misc] | ||
clean_on_exit = false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.19.1' | ||
check-latest: true | ||
cache: false | ||
- name: Run Revive Action by pulling pre-built image | ||
uses: docker://morphy/revive-action:v2 | ||
with: | ||
config: revive.toml | ||
path: "./..." | ||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Build | ||
run: | | ||
go version | ||
go mod tidy | ||
go build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.19.1' | ||
check-latest: true | ||
cache: false | ||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
# - name: Tests | ||
# run: | | ||
# go mod tidy | ||
# go test -v ./... | ||
- | ||
name: Docker Login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GH_PAT }} | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
if: success() && startsWith(github.ref, 'refs/tags/') | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,43 @@ | ||
--- | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
project_name: Prometheus-BME280-exporter | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- env: [CGO_ENABLED=0] | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- arm | ||
binary: prometheus-bme280-exporter | ||
ldflags: | ||
- "-X 'github.com/lukibahr/Prometheus-BME280-exporter/cmd.buildVersion={{.Version}}'" | ||
- "-X 'github.com/lukibahr/Prometheus-BME280-exporter/cmd.buildCommit={{.ShortCommit}}'" | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
- Merge pull request | ||
- Merge branch | ||
dockers: | ||
- image_templates: ["ghcr.io/lukibahr/Prometheus-BME280-exporter:{{ .Version }}"] | ||
dockerfile: Dockerfile | ||
build_flag_templates: | ||
- --label=org.opencontainers.image.source=github.com/lukibahr/Prometheus-BME280-exporter | ||
- --label=org.opencontainers.image.version={{ .Version }} | ||
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} | ||
- --label=org.opencontainers.image.revision={{ .FullCommit }} | ||
- --label=org.opencontainers.image.revision={{ .FullCommit }} | ||
- --label=org.opencontainers.image.title={{ .ProjectName }} | ||
- --label=org.opencontainers.image.description={{ .ProjectName }} | ||
- --label=org.opencontainers.image.url=https://github.com/lukibahr/prometheus-bme280-exporter |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
FROM golang:1.21-alpine as builder | ||
WORKDIR /go/src/app | ||
COPY . /go/src/app | ||
RUN CGO_ENABLED=0 GOARCH=arm GOARM=7 GOOS=linux go build -a -installsuffix cgo -o /go/bin/exporter . | ||
# syntax=docker/dockerfile:1 | ||
FROM gcr.io/distroless/base | ||
|
||
FROM alpine:3.16 | ||
COPY --from=builder /go/bin/exporter / | ||
ENTRYPOINT ["/exporter"] | ||
CMD [""] | ||
LABEL maintainer="hello@lukasbahr.de" | ||
|
||
COPY prometheus-bme280-exporter /usr/bin/prometheus-bme280-exporter | ||
ENTRYPOINT ["/usr/bin/prometheus-bme280-exporter"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM golang:1.21-alpine as builder | ||
WORKDIR /go/src/app | ||
COPY . /go/src/app | ||
RUN CGO_ENABLED=0 GOARCH=arm GOARM=7 GOOS=linux go build -a -installsuffix cgo -o /go/bin/exporter . | ||
|
||
FROM alpine:3.16 | ||
COPY --from=builder /go/bin/exporter / | ||
ENTRYPOINT ["/exporter"] | ||
CMD [""] |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# I just wanted to give taskfile.dev another try. This is optional. Get task here https://taskfile.dev/#/ | ||
# Next create a .env file | ||
|
||
version: '3' | ||
|
||
vars: | ||
GOLANGCILINT: | ||
sh: which golangci-lint | ||
GOLANG: | ||
sh: which go | ||
|
||
tasks: | ||
default: | ||
cmds: | ||
- task --list | ||
silent: true | ||
|
||
lint: | ||
desc: Run golangci-lint on your sourcecode | ||
preconditions: | ||
- sh: "[ '{{.GOLANGCILINT}}' != '<no value>' ]" | ||
msg: "golangci-lint executable not found" | ||
cmds: | ||
- | | ||
golangci-lint run -v | ||
silent: false | ||
|
||
build: | ||
desc: build binary | ||
preconditions: | ||
- sh: "[ '{{.GOLANG}}' != '<no value>' ]" | ||
msg: "go executable not found" | ||
cmds: | ||
- | | ||
GOOS=linux GOARCH=arm GOARM=7 go build | ||
GOOS=darwin GOARCH=arm64 go build -ldflags="-X 'github.com/lukibahr/prometheus-bme280-exporter/cmd.buildVersion=v0.0.4' -X 'github.com/lukibahr/prometheus-bme280-exporter/cmd.buildCommit=$(git rev-parse --short HEAD)'" -o release/rclone-daemon-darwin-arm64 main.go | ||
silent: false | ||
|
||
test: | ||
desc: Run go test on your sourcecode | ||
cmds: | ||
- | | ||
go test -v | ||
silent: false |
Oops, something went wrong.