Skip to content

Commit

Permalink
Automated tagged releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoshu committed Jun 18, 2020
1 parent d764b39 commit 7277155
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ jobs:
if: github.event_name == 'push' && endsWith(github.ref,'/master')
run: |
make push
TAG=latest make push
34 changes: 34 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: goreleaser

on:
push:
branches:
- "!*"
tags:
- "v*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v1
-
name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13.x
-
name: Login to DockerHub
run: |
# https://www.docker.com/blog/docker-hub-new-personal-access-tokens/
docker login --username "${{ secrets.DOCKER_USERNAME }}" --password "${{ secrets.DOCKER_PASSWORD }}"
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
project_name: node-detacher
builds:
- id: node-detacher
main: ./
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/mumoshu/node-detacher/Version={{.Version}}
changelog:
filters:
# commit messages matching the regexp listed here will be removed from
# the changelog
# Default is empty
exclude:
- '^docs:'
- typo
dockers:
- goos: linux
goarch: amd64
goarm: ''
binaries:
- node-detacher
builds:
- node-detacher
image_templates:
- "mumoshu/node-detacher:latest"
- "mumoshu/node-detacher:{{ .Tag }}"
- "mumoshu/node-detacher:v{{ .Major }}"
build_flag_templates:
- "--pull"
dockerfile: Dockerfile.release
14 changes: 14 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# builder
FROM golang as build

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /

COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY ./node-detacher /manager

USER nonroot:nonroot

ENTRYPOINT ["/manager"]
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,7 @@ manual-test:
kubectl taint node kind-worker ToBeDeletedByClusterAutoscaler=:NoSchedule
sleep 20
kubectl taint node kind-worker ToBeDeletedByClusterAutoscaler-

.PHONY: test-publish
test-publish:
NODE_DETACHER_VERSION=0.1.0 goreleaser --snapshot --skip-publish --rm-dist

0 comments on commit 7277155

Please sign in to comment.