-
Notifications
You must be signed in to change notification settings - Fork 58
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
Showing
16 changed files
with
228 additions
and
185 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,34 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" # Will trigger only if tag is pushed matching pattern `v*` (Eg: `v0.1.0`) | ||
|
||
jobs: | ||
goreleaser: | ||
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.17 | ||
|
||
- name: Login to Docker Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: --parallelism 1 --rm-dist --skip-validate | ||
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 |
---|---|---|
@@ -1,58 +1,83 @@ | ||
env: | ||
- GO111MODULE=on | ||
- CGO_ENABLED=0 | ||
- RELEASE_BUILDS=dist/calert_darwin_amd64/calert dist/calert_linux_amd64/calert dist/calert_windows_amd64//calert.exe | ||
|
||
builds: | ||
- binary: calert | ||
- binary: calert.bin | ||
id: calert | ||
goos: | ||
- windows | ||
- darwin | ||
- linux | ||
goarch: | ||
- amd64 | ||
ldflags: | ||
- -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})" | ||
- -s -w -X "main.buildString={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})" | ||
dir: ./cmd/ | ||
|
||
archives: | ||
- format: tar.gz | ||
files: | ||
- config.sample.toml | ||
- README.md | ||
- LICENSE | ||
- message.tmpl | ||
- config.sample.toml | ||
- static/ | ||
|
||
dockers: | ||
# You can have multiple Docker images. | ||
- | ||
# GOOS of the built binary that should be used. | ||
- # ID of the image, needed if you want to filter by it later on (e.g. on custom publishers). | ||
id: calert | ||
|
||
# GOOS of the built binaries/packages that should be used. | ||
goos: linux | ||
# GOARCH of the built binary that should be used. | ||
|
||
# GOARCH of the built binaries/packages that should be used. | ||
goarch: amd64 | ||
# GOARM of the built binary that should be used. | ||
goarm: '' | ||
# Name templates of the built binaries that should be used. | ||
id: calert | ||
|
||
# IDs to filter the binaries/packages. | ||
ids: | ||
- calert | ||
|
||
# Templates of the Docker image names. | ||
image_templates: | ||
- "mrkaran/calert:latest" | ||
- "mrkaran/calert:{{ .Tag }}" | ||
# Skips the docker push. Could be useful if you also do draft releases. | ||
# If set to auto, the release will not be pushed to the docker repository | ||
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 | ||
- "ghcr.io/mr-karan/calert:{{ .Tag }}" | ||
- "ghcr.io/mr-karan/calert:latest" | ||
|
||
# Skips the docker push. | ||
# Could be useful if you also do draft releases. | ||
# | ||
# If set to auto, the release will not be pushed to the Docker repository | ||
# in case there is an indicator of a prerelease in the tag, e.g. v1.0.0-rc1. | ||
# | ||
# Defaults to false. | ||
skip_push: false | ||
|
||
# Path to the Dockerfile (from the project root). | ||
dockerfile: Dockerfile | ||
# If your Dockerfile copies files other than the binary itself, | ||
|
||
# Set the "backend" for the Docker pipe. | ||
# Valid options are: docker, buildx, podman, buildpacks | ||
# podman is a GoReleaser Pro feature and is only available on Linux. | ||
# Defaults to docker. | ||
use: docker | ||
|
||
# Template of the docker build flags. | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.title={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
- "--platform=linux/amd64" | ||
|
||
# If your Dockerfile copies files other than binaries and packages, | ||
# you should list them here as well. | ||
# Note that goreleaser will create the same structure inside the temporary | ||
# Note that GoReleaser will create the same structure inside a temporary | ||
# folder, so if you add `foo/bar.json` here, on your Dockerfile you can | ||
# `COPY foo/bar.json /whatever.json`. | ||
# Also note that the paths here are relative to the folder in which | ||
# goreleaser is being run. | ||
# GoReleaser is being run (usually the repository root folder). | ||
# This field does not support wildcards, you can add an entire folder here | ||
# and use wildcards when you `COPY`/`ADD` in your Dockerfile. | ||
extra_files: | ||
- config.sample.toml | ||
- message.tmpl | ||
- config.sample.toml | ||
- static/ |
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,6 @@ | ||
FROM ubuntu:20.04 | ||
WORKDIR /app | ||
COPY calert.bin . | ||
COPY static/ /app/static/ | ||
COPY config.sample.toml . | ||
CMD ["./calert.bin"] |
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
Oops, something went wrong.