Skip to content

Commit e538874

Browse files
authored
Merge pull request #36 from goccy/release-image
Add workflow for release image
2 parents 872fafd + fe2b0d9 commit e538874

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

Diff for: .github/workflows/release.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: release image
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
env:
7+
REGISTRY: ghcr.io
8+
9+
jobs:
10+
build-image:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: docker/metadata-action@v3
18+
id: meta
19+
with:
20+
images: ${{ env.REGISTRY }}/goccy/go-zetasql
21+
tags: |
22+
type=semver,pattern={{version}}
23+
type=semver,pattern={{major}}.{{minor}}
24+
- name: setup docker buildx
25+
uses: docker/setup-buildx-action@v2
26+
- name: cache for linux
27+
uses: actions/cache@v3
28+
if: runner.os == 'Linux'
29+
with:
30+
path: |
31+
~/.cache/go-build
32+
~/go/pkg/mod
33+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
34+
restore-keys: |
35+
${{ runner.os }}-go-
36+
- uses: docker/login-action@v2
37+
with:
38+
registry: ${{ env.REGISTRY }}
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
- uses: docker/build-push-action@v3
42+
with:
43+
context: .
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+
cache-from: type=local,src=~/.cache/go-build
48+
build-args: |
49+
VERSION=v${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}

Diff for: Dockerfile

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
FROM golang:1.21-bookworm
22

3+
ARG VERSION
4+
35
RUN apt-get update && apt-get install -y --no-install-recommends clang
46

57
ENV CGO_ENABLED 1
68
ENV CXX clang++
79

8-
COPY . /go-zetasql
10+
WORKDIR /work
11+
12+
COPY ./go.* ./
13+
RUN go mod download
14+
15+
COPY . ./
916

10-
WORKDIR /go-zetasql
17+
RUN go install .

0 commit comments

Comments
 (0)