-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa886e9
commit b2aaadd
Showing
7 changed files
with
125 additions
and
23 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,40 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.22' | ||
|
||
- run: go mod tidy | ||
- run: go test ./... | ||
|
||
- name: Login to ghcr.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,23 @@ | ||
project_name: adguard-exporter | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- env: [CGO_ENABLED=0] | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
main: main.go | ||
archives: | ||
- format: tar.gz | ||
checksum: | ||
name_template: 'checksums.txt' | ||
dockers: | ||
- dockerfile: Dockerfile | ||
image_templates: | ||
- ghcr.io/henrywhitaker3/adguard-exporter:{{ .Tag }} | ||
- ghcr.io/henrywhitaker3/adguard-exporter:latest |
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,22 +1,7 @@ | ||
ARG IMAGE=scratch | ||
ARG OS=linux | ||
ARG ARCH=amd64 | ||
FROM scratch | ||
WORKDIR / | ||
|
||
FROM golang:1.21.5-alpine3.17 as builder | ||
COPY adguard-exporter /adguard-exporter | ||
USER 65532:65532 | ||
|
||
WORKDIR /go/src/github.com/henrywhitaker3/adguard-exporter | ||
COPY . . | ||
|
||
RUN apk --no-cache add git alpine-sdk | ||
|
||
RUN GO111MODULE=on go mod vendor | ||
RUN CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH go build -ldflags '-s -w' -o binary ./ | ||
|
||
FROM $IMAGE | ||
|
||
LABEL name="pihole-exporter" | ||
|
||
WORKDIR /root/ | ||
COPY --from=builder /go/src/github.com/henrywhitaker3/adguard-exporter/binary pihole-exporter | ||
|
||
CMD ["./pihole-exporter"] | ||
ENTRYPOINT ["/adguard-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
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