Skip to content

Commit 26c55a7

Browse files
committed
build: build
1 parent fde6e96 commit 26c55a7

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/build-publish.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and Publish
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: write
8+
packages: write
9+
pull-requests: write
10+
11+
jobs:
12+
build-and-push-docker-image:
13+
name: Build Docker image and push to repositories
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: googleapis/release-please-action@v4
18+
with:
19+
release-type: simple
20+
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup Go
27+
uses: actions/setup-go@v4
28+
with:
29+
go-version: 'stable'
30+
31+
- name: Setup ko
32+
uses: ko-build/[email protected]
33+
34+
- name: Login to Github Packages
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Build containers
42+
run: |
43+
git fetch --tags
44+
descr=$(git describe --tags)
45+
short=$(git describe --tags --abbrev=0)
46+
export version="${descr#v}"
47+
if [[ $descr == $short ]]; then
48+
minor="${version%.*}"
49+
major="${version%%.*}"
50+
tags=(-t edge -t latest -t "$version" -t "$minor" -t "$major")
51+
else
52+
tags=(-t edge)
53+
fi
54+
ko build --bare --sbom=none "${tags[@]}" .
55+
env:
56+
KO_DOCKER_REPO: ghcr.io/kastelo/ezapt

0 commit comments

Comments
 (0)