Skip to content

Commit

Permalink
gha release: split docker and binaries. tag name as VERSION in build-…
Browse files Browse the repository at this point in the history
…arg (#256)

* client: print version

* arkd: add --version

* release action refactor
  • Loading branch information
tiero authored Aug 15, 2024
1 parent 6ce090b commit faecf1a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 147 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/ark.release.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
name: release
name: Release Binaries and Docker Build

on:
release:
types: [released]


permissions:
contents: write
packages: write

jobs:
build:
build-and-upload:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -22,10 +20,11 @@ jobs:
with:
go-version: 1.21.0

# Build binaries for all architectures
- name: Build binaries
run: make build-all

# Server
# Server binary uploads
- name: Upload server binary (Linux, AMD64)
uses: actions/upload-release-asset@v1
env:
Expand Down Expand Up @@ -66,7 +65,7 @@ jobs:
asset_name: arkd-darwin-arm64
asset_content_type: application/octet-stream

# CLI
# CLI binary uploads
- name: Upload client binary (Linux, AMD64)
uses: actions/upload-release-asset@v1
env:
Expand Down Expand Up @@ -107,7 +106,7 @@ jobs:
asset_name: ark-darwin-arm64
asset_content_type: application/octet-stream

# WASM SDK
# WASM SDK upload
- name: Upload WASM SDK
uses: actions/upload-release-asset@v1
env:
Expand All @@ -118,7 +117,12 @@ jobs:
asset_name: ark-sdk.wasm
asset_content_type: application/wasm

# Docker
docker-build-and-push:
runs-on: ubuntu-latest
needs: build-and-upload
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker
uses: docker/setup-buildx-action@v1
Expand All @@ -137,3 +141,5 @@ jobs:
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository }}:latest
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ github.event.release.tag_name }}
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
FROM golang:1.21.0 AS builder

ARG VERSION
ARG COMMIT
ARG DATE
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -12,8 +10,8 @@ WORKDIR /app
COPY . .

ENV GOPROXY=https://goproxy.io,direct
RUN cd server && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${VERSION}' -X 'main.Commit=${COMMIT}' -X 'main.Date=${DATE}}'" -o ../bin/arkd ./cmd/arkd
RUN cd client && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${VERSION}}' -X 'main.Commit=${COMMIT}' -X 'main.Date=${DATE}}'" -o ../bin/ark .
RUN cd server && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${VERSION}'" -o ../bin/arkd ./cmd/arkd
RUN cd client && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${VERSION}}'" -o ../bin/ark .

# Second image, running the arkd executable
FROM alpine:3.12
Expand Down
99 changes: 0 additions & 99 deletions server/.goreleaser.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions server/goreleaser.Dockerfile

This file was deleted.

0 comments on commit faecf1a

Please sign in to comment.