Skip to content

Commit

Permalink
Cleanup release workflow for goreleaser (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Auerbeck <[email protected]>
Co-authored-by: Tyler Auerbeck <[email protected]>
  • Loading branch information
tylerauerbeck and tylerauerbeck authored Jun 23, 2023
1 parent eca5ac4 commit 198d629
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
45 changes: 34 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: release
name: Release
on:
push:
tags:
- 'v**'
- v**

jobs:
release:
helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -21,11 +21,34 @@ jobs:
chart_version: ${{ github.ref_name }}
branch: gh-pages

container-main:
uses: metal-toolbox/container-push/.github/workflows/container-push.yml@main
with:
name: ipam-api
tag: ${{ github.ref_name }}
registry_org: ${{ github.repository_owner }}
dockerfile_path: Dockerfile
platforms: linux/amd64,linux/arm64
goreleaser:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- run: git fetch --force --tags

- uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser-pro
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
5 changes: 5 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json

includes:
- from_url:
url: https://raw.githubusercontent.com/infratographer/release/main/goreleaser/base.yml
14 changes: 3 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
FROM golang:1.20.5 AS builder

COPY . /src
WORKDIR /src

# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/ipam-api .

# Pass in name as --build-arg
FROM gcr.io/distroless/static:nonroot
# `nonroot` coming from distroless
USER 65532:65532

COPY --from=builder /src/bin/ipam-api /ipam-api
# Copy the binary that goreleaser built
COPY ipam-api /ipam-api

# Run the web service on container startup.
ENTRYPOINT ["/ipam-api"]
CMD ["serve"]
CMD ["serve"]

0 comments on commit 198d629

Please sign in to comment.