Skip to content

Commit 5df52c1

Browse files
committed
initial test
1 parent fba2c67 commit 5df52c1

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.github/workflows/release.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ on:
44
push:
55
tags:
66
- "v[0-9]+.[0-9]+.[0-9]+"
7+
- "mytest"
78

89
permissions:
910
contents: write
1011

12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}
15+
1116
jobs:
1217
goreleaser:
1318
runs-on: ubuntu-latest
@@ -26,3 +31,39 @@ jobs:
2631
args: release --clean
2732
env:
2833
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
packagerelease:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
packages: write
39+
attestations: write
40+
id-token: write
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v5
44+
- name: Log in to the Container registry
45+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
46+
with:
47+
registry: ${{ env.REGISTRY }}
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
- name: Extract metadata (tags, labels) for Docker
51+
id: meta
52+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
53+
with:
54+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
55+
- name: Build and push Docker image
56+
id: push
57+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
58+
with:
59+
context: .
60+
push: true
61+
tags: ${{ steps.meta.outputs.tags }}
62+
labels: ${{ steps.meta.outputs.labels }}
63+
64+
- name: Generate artifact attestation
65+
uses: actions/attest-build-provenance@v3
66+
with:
67+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
68+
subject-digest: ${{ steps.push.outputs.digest }}
69+
push-to-registry: true

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM golang:1.24-alpine AS builder
2+
COPY . /build
3+
WORKDIR /build
4+
5+
RUN go mod download && \
6+
CGO_ENABLED=0 GO111MODULE=on GOOS=linux go build -ldflags="-X 'main.appName=NetAssert' -X 'main.version=2.0.0-dev'" -v -o /netassertv2 cmd/netassert/cli/*.go && \
7+
ls -ltr /netassertv2
8+
9+
FROM gcr.io/distroless/base:nonroot
10+
COPY --from=builder /netassertv2 /usr/bin/netassertv2
11+
12+
ENTRYPOINT [ "/usr/bin/netassertv2" ]

0 commit comments

Comments
 (0)