-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: setup goreleaser Docker images published to hub and github Bare binaries published to github Builds for mac/windows/linux * amd64/arm
- Loading branch information
1 parent
2632438
commit 3ead917
Showing
5 changed files
with
147 additions
and
55 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 |
---|---|---|
@@ -1,12 +1,60 @@ | ||
name: Build | ||
on: push | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v1 | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16' | ||
- | ||
name: Cache Go modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- | ||
name: Login to Docker Hub | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- | ||
name: Login to GitHub Container Registry | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
go-version: 1.13 | ||
- uses: actions/checkout@v2 | ||
- run: go build -v . | ||
# either 'goreleaser' (default) or 'goreleaser-pro' | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/ | ||
tezos_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,86 @@ | ||
# This is an example .goreleaser.yml 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 go modules. | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
dockers: | ||
- image_templates: | ||
- 'ecadlabs/tezos_exporter:{{ .Tag }}-amd64' | ||
- 'ecadlabs/tezos_exporter:latest-amd64' | ||
- 'ghcr.io/ecadlabs/tezos_exporter:{{ .Tag }}-amd64' | ||
- 'ghcr.io/ecadlabs/tezos_exporter:latest-amd64' | ||
dockerfile: Dockerfile | ||
use: buildx | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.name={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
- "--label=org.opencontainers.image.source={{.GitURL}}" | ||
- "--platform=linux/amd64" | ||
- image_templates: | ||
- 'ecadlabs/tezos_exporter:{{ .Tag }}-arm64' | ||
- 'ecadlabs/tezos_exporter:latest-arm64' | ||
- 'ghcr.io/ecadlabs/tezos_exporter:{{ .Tag }}-arm64' | ||
- 'ghcr.io/ecadlabs/tezos_exporter:latest-arm64' | ||
dockerfile: Dockerfile | ||
use: buildx | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.name={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
- "--label=org.opencontainers.image.source={{.GitURL}}" | ||
- "--platform=linux/arm64" | ||
goarch: arm64 | ||
docker_manifests: | ||
- name_template: 'ecadlabs/tezos_exporter:{{ .Tag }}' | ||
image_templates: | ||
- 'ecadlabs/tezos_exporter:{{ .Tag }}-amd64' | ||
- 'ecadlabs/tezos_exporter:{{ .Tag }}-arm64' | ||
- name_template: 'ghcr.io/ecadlabs/tezos_exporter:{{ .Tag }}' | ||
image_templates: | ||
- 'ghcr.io/ecadlabs/tezos_exporter:{{ .Tag }}-amd64' | ||
- 'ghcr.io/ecadlabs/tezos_exporter:{{ .Tag }}-arm64' | ||
- name_template: 'ecadlabs/tezos_exporter:latest' | ||
image_templates: | ||
- 'ecadlabs/tezos_exporter:{{ .Tag }}-amd64' | ||
- 'ecadlabs/tezos_exporter:{{ .Tag }}-arm64' | ||
- name_template: 'ghcr.io/ecadlabs/tezos_exporter:latest' | ||
image_templates: | ||
- 'ghcr.io/ecadlabs/tezos_exporter:{{ .Tag }}-amd64' | ||
- 'ghcr.io/ecadlabs/tezos_exporter:{{ .Tag }}-arm64' | ||
|
||
|
||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
amd64: x86_64 | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
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,14 +1,7 @@ | ||
# build stage | ||
FROM golang:1.13-alpine AS build-env | ||
WORKDIR /tezos_exporter | ||
ADD . . | ||
RUN apk --no-cache add git | ||
RUN go get -d ./... | ||
RUN go build | ||
|
||
# final stage | ||
FROM alpine | ||
WORKDIR /app | ||
COPY --from=build-env /tezos_exporter/tezos_exporter /usr/bin/tezos_exporter | ||
|
||
ENTRYPOINT ["/usr/bin/tezos_exporter"] | ||
CMD ["-tezos-node-url" "http://localhost:8732/"] | ||
|
||
|
||
COPY tezos_exporter /usr/bin/tezos_exporter |