Skip to content

Commit

Permalink
Add Goreleaser, Dockerfile and GH Action
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir-Ahmad committed Jun 4, 2023
1 parent 4cab7a1 commit 618043a
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: release

on:
push:
tags:
- "v*"

permissions:
contents: write
packages: write

jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/amir-ahmad/cuemix
tags: |
type=semver,pattern={{version}}
type=sha,prefix=
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.charts/
bin/
dist/

# Binaries for programs and plugins
*.exe
Expand Down
34 changes: 34 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
project_name: cuemix

builds:
- env:
- CGO_ENABLED=0
main: cmd/main.go
ldflags:
- -s -w -X "github.com/amir-ahmad/cuemix/cmd/cuemix.version={{ .Version }}"
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
binary: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
no_unique_dist_dir: true

archives:
- format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM cuelang/cue:0.5.0 as cue

FROM alpine:3.18.0

ARG TARGETARCH

COPY "dist/cuemix_linux_${TARGETARCH}" /usr/bin/cuemix
COPY --from=cue /usr/bin/cue /usr/bin/cue

RUN apk add --no-cache git

WORKDIR /app

ENTRYPOINT ["cuemix"]

0 comments on commit 618043a

Please sign in to comment.