Skip to content

Commit

Permalink
Feat add release CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bullet-tooth committed Mar 27, 2024
1 parent efe445d commit 3189ed1
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github
build
.golangci.yml
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
release:
types: [created]

permissions:
contents: write
packages: write

jobs:
release-binaries:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
- goarch: arm64
goos: windows
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "1.21.5"
project_path: "./cmd/keygen"
binary_name: "keygen"

release-docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: stroomnetwork/keygen:${{ github.ref }}
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:1.21.5 as builder

WORKDIR "/go/src/keygen"

COPY . ./

RUN make build

FROM alpine:3.19

COPY --from=builder /go/src/keygen/build/keygen /usr/local/bin/

CMD ["help"]
ENTRYPOINT ["keygen"]

0 comments on commit 3189ed1

Please sign in to comment.