Skip to content

Commit

Permalink
feat: #1 implements
Browse files Browse the repository at this point in the history
  • Loading branch information
h-r-k-matsumoto committed Nov 27, 2020
1 parent 6471ceb commit c866cd2
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release

on:
push:
branches-ignore:
- '**'
tags:
- 'v*'

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set env
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.USERNAME }}
password: ${{ secrets.CR_PAT }}

- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: |
${{ github.repository_owner }}:latest
${{ github.repository_owner }}:${{ env.TAG_VERSION }}
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.CR_PAT }}
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ FROM golang:1.14 AS builder
WORKDIR /go/src/github.com/rakutentech/passenger-go-exporter

COPY go.mod go.sum ./
RUN go mod download && go get github.com/goreleaser/goreleaser
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /main .

ARG GITHUB_TOKEN
RUN goreleaser

FROM scratch
WORKDIR /app
COPY --from=builder /main /app/main
Expand Down

0 comments on commit c866cd2

Please sign in to comment.