Skip to content

Commit 1f723ca

Browse files
committed
chore: updated CodeQL and Docker GitHub workflows
1 parent 4c9da04 commit 1f723ca

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ on:
88
- master
99

1010
jobs:
11-
run:
11+
go:
1212
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
1316
steps:
1417
- name: Checkout repository
1518
uses: actions/checkout@v5
1619

1720
- name: Set up Go
1821
uses: actions/setup-go@v5
1922
with:
20-
go-version: '1.22'
23+
go-version: '1.25'
2124

2225
- name: Go Build
2326
run: go build ./...

.github/workflows/codeql.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@ on:
77

88
jobs:
99
analyze:
10-
name: Analyze
10+
name: Analyze (${{ matrix.language }})
1111
runs-on: ubuntu-latest
12-
12+
permissions:
13+
security-events: write
14+
packages: read
15+
actions: read
16+
contents: read
1317
strategy:
1418
fail-fast: false
1519
matrix:
16-
languages:
17-
- go
20+
include:
21+
- language: actions
22+
build-mode: none
23+
- language: go
24+
build-mode: autobuild
1825

1926
steps:
2027
- name: Checkout repository
@@ -23,13 +30,11 @@ jobs:
2330
- name: Initialize CodeQL
2431
uses: github/codeql-action/init@v3
2532
with:
26-
languages: ${{ matrix.languages }}
33+
languages: ${{ matrix.language }}
34+
build-mode: ${{ matrix.build-mode }}
2735
queries: security-extended,security-and-quality
2836

29-
- name: Autobuild
30-
uses: github/codeql-action/autobuild@v3
31-
3237
- name: Perform CodeQL Analysis
3338
uses: github/codeql-action/analyze@v3
3439
with:
35-
category: /language:${{ matrix.languages }}
40+
category: "/language:${{matrix.language}}"

.github/workflows/docker-publish.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,29 @@ env:
1111

1212
jobs:
1313
build:
14-
name: Build
1514
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
id-token: write
1619

1720
steps:
1821
- name: Checkout repository
1922
uses: actions/checkout@v5
2023

21-
- name: Setup Docker buildx
24+
- name: Install cosign
25+
if: github.event_name == 'release'
26+
uses: sigstore/[email protected]
27+
28+
- name: Set up Docker Buildx
2229
uses: docker/setup-buildx-action@v3
2330

2431
- name: Log into registry ${{ env.REGISTRY }}
32+
if: github.event_name == 'release'
2533
uses: docker/login-action@v3
2634
with:
2735
registry: ${{ env.REGISTRY }}
28-
username: ${{ github.repository_owner }}
36+
username: ${{ github.actor }}
2937
password: ${{ secrets.GITHUB_TOKEN }}
3038

3139
- name: Extract Docker metadata
@@ -35,12 +43,20 @@ jobs:
3543
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3644

3745
- name: Build and push Docker image
46+
id: build-and-push
3847
uses: docker/build-push-action@v6
3948
with:
4049
context: .
50+
push: ${{ github.event_name == 'release' }}
4151
labels: ${{ steps.meta.outputs.labels }}
52+
tags: ${{ steps.meta.outputs.tags }}
4253
platforms: |
4354
linux/amd64
4455
linux/arm64
45-
push: true
46-
tags: ${{ steps.meta.outputs.tags }}
56+
57+
- name: Sign the published Docker image
58+
if: github.event_name == 'release'
59+
env:
60+
TAGS: ${{ steps.meta.outputs.tags }}
61+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
62+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

0 commit comments

Comments
 (0)