Skip to content

Commit

Permalink
chore: add deploy flow
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudingcity committed Aug 30, 2020
1 parent d762339 commit eaae628
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 8 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy
on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Docker Login
if: success() && startsWith(github.ref, 'refs/tags/v')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
51 changes: 51 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
project_name: gool
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
brews:
-
description: "A toolkit make your programmer life easier"
homepage: "https://github.com/cloudingcity/gool"
tap:
owner: cloudingcity
name: homebrew-tap
install: |
bin.install "gool"
dockers:
-
binaries:
- gool
image_templates:
- "ghost0436/gool:latest"
- "ghost0436/gool:{{ .Tag }}"
dockerfile: Dockerfile
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}}"
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
10 changes: 2 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
FROM golang:1.15-alpine as build
COPY . /app
WORKDIR /app
RUN go build -o gool

FROM alpine:3.12
WORKDIR /app
COPY --from=build /app/gool .
FROM scratch
COPY gool .
ENTRYPOINT ["./gool"]

0 comments on commit eaae628

Please # to comment.