Skip to content

Commit e95dd88

Browse files
authored
Merge pull request #24 from avedor/feat/create-dev-containers
Introduce Tagging from Dev Branch
2 parents 34462f0 + 884f293 commit e95dd88

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
# Sequence of patterns matched against refs/tags
44
tags:
55
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
branches:
7+
- dev
68

79
name: Latest Release
810

@@ -18,7 +20,7 @@ jobs:
1820
- uses: actions/checkout@v4
1921
- uses: actions/setup-go@v4
2022
with:
21-
go-version: '1.21.6'
23+
go-version: '1.23'
2224
- name: golangci-lint
2325
uses: golangci/[email protected]
2426
with:
@@ -28,6 +30,7 @@ jobs:
2830
contents: write
2931
name: Create Release
3032
runs-on: 'ubuntu-latest'
33+
if: startsWith(github.ref, 'refs/tags/v')
3134
strategy:
3235
matrix:
3336
# List of GOOS and GOARCH pairs from `go tool dist list`
@@ -41,7 +44,7 @@ jobs:
4144
fetch-depth: 0
4245
- uses: actions/setup-go@v4
4346
with:
44-
go-version: '1.21.6'
47+
go-version: '1.23'
4548
- name: Get OS and arch info
4649
run: |
4750
GOOSARCH=${{matrix.goosarch}}
@@ -66,12 +69,12 @@ jobs:
6669
build:
6770
name: Build/publish container image
6871
runs-on: ubuntu-latest
72+
if: startsWith(github.ref, 'refs/tags/v') # only build latest from tagged versions
73+
needs: release
6974
permissions:
7075
contents: read
7176
packages: write
7277
id-token: write
73-
if: "!contains(github.ref, 'dev')" # skip building container for dev
74-
needs: release
7578

7679
steps:
7780
- name: Checkout repository
@@ -106,3 +109,41 @@ jobs:
106109
cache-from: type=gha
107110
cache-to: type=gha,mode=max
108111
platforms: linux/amd64,linux/386
112+
113+
build-dev:
114+
name: Build/publish dev image
115+
runs-on: ubuntu-latest
116+
if: github.ref == 'refs/heads/dev'
117+
permissions:
118+
contents: read
119+
packages: write
120+
id-token: write
121+
122+
steps:
123+
- name: Checkout repository
124+
uses: actions/checkout@v4
125+
with:
126+
fetch-depth: 0
127+
128+
- name: Login to ghcr.io
129+
uses: docker/login-action@v2
130+
with:
131+
registry: ghcr.io
132+
username: ${{ github.actor }}
133+
password: ${{ secrets.GITHUB_TOKEN }}
134+
135+
- name: Convert repository name to lowercase
136+
run: echo "REPO_LC=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
137+
138+
- name: Set up Docker Buildx
139+
uses: docker/setup-buildx-action@v2
140+
141+
- name: Build and push dev image
142+
uses: docker/build-push-action@v5
143+
with:
144+
context: .
145+
push: true
146+
tags: ghcr.io/${{ env.REPO_LC }}:dev
147+
cache-from: type=gha
148+
cache-to: type=gha,mode=max
149+
platforms: linux/amd64,linux/386

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.21-alpine AS builder
1+
FROM golang:1.23-alpine AS builder
22

33
# Set the working directory
44
WORKDIR /app
@@ -8,7 +8,7 @@ COPY ./ .
88

99
# Build the Go binary based on the target architecture
1010
ARG TARGETARCH
11-
RUN GOOS=linux GOARCH=${TARGETARCH} go build -o explo ./src/
11+
RUN GOOS=linux GOARCH=${TARGETARCH} go build -o explo ./src/main/
1212

1313
FROM alpine
1414

0 commit comments

Comments
 (0)