Skip to content

Commit beede1a

Browse files
committed
initial
0 parents  commit beede1a

19 files changed

Lines changed: 1333 additions & 0 deletions

File tree

.dockerignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Git and GitHub
2+
.git
3+
.github
4+
.gitignore
5+
.dockerignore
6+
7+
# Build and CI artifacts
8+
*.test
9+
*.out
10+
*.prof
11+
*.json
12+
*.txt
13+
Makefile
14+
docker-compose.yml
15+
16+
# Documentation
17+
README.md
18+
LICENSE
19+
20+
# Source code that shouldn't be in the runtime image
21+
* _test.go
22+
docs/
23+
24+
# IDE files
25+
.vscode
26+
.idea

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
ci:
11+
name: CI
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v5
16+
17+
- uses: actions/setup-go@v6
18+
with:
19+
go-version: 1.25
20+
21+
- name: Test
22+
run: go test -v ./...
23+
24+
- name: Lint
25+
uses: golangci/golangci-lint-action@v9
26+
with:
27+
version: v2.7

.github/workflows/release.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
packages: write
12+
id-token: write
13+
14+
jobs:
15+
ci:
16+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
17+
uses: ./.github/workflows/ci.yml
18+
secrets: inherit
19+
20+
build-and-publish:
21+
name: Build, Sign and Publish
22+
needs: ci
23+
runs-on: ubuntu-latest
24+
env:
25+
REGISTRY: ghcr.io
26+
IMAGE_NAME: ${{ github.repository }}
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v5
31+
32+
- name: Install Cosign
33+
uses: sigstore/cosign-installer@v3.7.0
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Log in to Docker registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: dhi.io
45+
username: ${{ secrets.DHI_USERNAME }}
46+
password: ${{ secrets.DHI_TOKEN }}
47+
48+
- name: Log in to GitHub registry
49+
uses: docker/login-action@v3
50+
with:
51+
registry: ${{ env.REGISTRY }}
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Extract Docker metadata
56+
id: meta
57+
uses: docker/metadata-action@v5
58+
with:
59+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
60+
tags: |
61+
type=semver,pattern={{version}}
62+
type=raw,value=latest
63+
64+
- name: Build and push Docker image
65+
id: build-and-push
66+
uses: docker/build-push-action@v6
67+
with:
68+
context: .
69+
platforms: linux/amd64,linux/arm64
70+
push: true
71+
tags: ${{ steps.meta.outputs.tags }}
72+
labels: ${{ steps.meta.outputs.labels }}
73+
annotations: ${{ steps.meta.outputs.annotations }}
74+
cache-from: type=gha
75+
cache-to: type=gha,mode=max
76+
77+
- name: Sign the published Docker image
78+
env:
79+
TAGS: ${{ steps.meta.outputs.tags }}
80+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
81+
run: |
82+
images=""
83+
for tag in ${TAGS}; do
84+
images+="${tag}@${DIGEST} "
85+
done
86+
cosign sign --yes ${images}
87+
88+
github-release:
89+
name: Create GitHub Release
90+
if: startsWith(github.ref, 'refs/tags/')
91+
needs: build-and-publish
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Checkout code
95+
uses: actions/checkout@v5
96+
97+
- name: Create Release
98+
uses: softprops/action-gh-release@v2
99+
with:
100+
generate_release_notes: true
101+
102+
cleanup:
103+
name: Cleanup Untagged Images
104+
needs: build-and-publish
105+
runs-on: ubuntu-latest
106+
permissions:
107+
packages: write
108+
steps:
109+
- name: Delete untagged images
110+
uses: actions/delete-package-versions@v5
111+
with:
112+
package-name: ${{ github.event.repository.name }}
113+
package-type: "container"
114+
package-origin: "repository"
115+
min-versions-to-keep: 0
116+
delete-only-untagged-versions: "true"

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Code coverage profiles and other test artifacts
15+
*.out
16+
coverage.*
17+
*.coverprofile
18+
profile.cov
19+
20+
# Dependency directories (remove the comment below to include it)
21+
# vendor/
22+
23+
# Go workspace file
24+
go.work
25+
go.work.sum
26+
27+
# env file
28+
.env
29+
30+
# Editor/IDE
31+
# .idea/
32+
# .vscode/

0 commit comments

Comments
 (0)