Skip to content

Commit 32005f8

Browse files
committed
ci: address changes requested by @Gerrit91
1 parent 3cb10e3 commit 32005f8

File tree

2 files changed

+56
-46
lines changed

2 files changed

+56
-46
lines changed

.github/workflows/docker.yaml

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,44 @@ jobs:
1919
build:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
24-
25-
- name: Figure out if running fork PR
26-
id: fork
27-
run: '["${{ secrets.DOCKER_REGISTRY_TOKEN }}" == ""] && echo "::set-output name=is_fork_pr::true" || echo "::set-output name=is_fork_pr::false"'
28-
if: ${{ github.event_name == 'pull_request' }}
29-
30-
- name: Docker Login
31-
uses: docker/login-action@v3
32-
with:
33-
registry: ${{ secrets.DOCKER_REGISTRY }}
34-
username: ${{ secrets.DOCKER_REGISTRY_USER }}
35-
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
36-
if: ${{ github.event_name != 'pull_request' || steps.fork.outputs.is_fork_pr == 'false' }}
37-
38-
- name: Set up Go 1.24
39-
uses: actions/setup-go@v5
40-
with:
41-
go-version: '1.24.x'
42-
43-
- name: Lint
44-
uses: golangci/golangci-lint-action@v7
45-
46-
- name: Make tag
47-
run: |
48-
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=pr-${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
49-
[ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
50-
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=latest" >> $GITHUB_ENV || true
51-
52-
- name: Set up Docker Buildx
53-
uses: docker/setup-buildx-action@v3
54-
if: ${{ github.event_name != 'pull_request' || steps.fork.outputs.is_fork_pr == 'false' }}
55-
56-
- name: Build and push image
57-
uses: docker/build-push-action@v6
58-
with:
59-
context: .
60-
push: ${{ github.event_name != 'pull_request' || steps.fork.outputs.is_fork_pr == 'false' }}
61-
sbom: true
62-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.tag }}
63-
64-
- uses: release-drafter/release-drafter@v6
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
if: ${{ github.event_name == 'push' }}
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Figure out if running fork PR
26+
id: fork
27+
run: |
28+
["${{ secrets.DOCKER_REGISTRY_TOKEN }}" == ""] && echo "is_fork_pr=true" >> $GITHUB_ENV || echo "is_fork_pr=false" >> $GITHUB_ENV
29+
if: ${{ github.event_name == 'pull_request' }}
30+
31+
- name: Docker Login
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ${{ secrets.DOCKER_REGISTRY }}
35+
username: ${{ secrets.DOCKER_REGISTRY_USER }}
36+
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
37+
if: ${{ github.event_name != 'pull_request' || steps.fork.outputs.is_fork_pr == 'false' }}
38+
39+
- name: Set up Go 1.24
40+
uses: actions/setup-go@v5
41+
with:
42+
go-version: '1.24.x'
43+
44+
- name: Lint
45+
uses: golangci/golangci-lint-action@v7
46+
47+
- name: Make tag
48+
run: |
49+
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=pr-${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
50+
[ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
51+
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=latest" >> $GITHUB_ENV || true
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
56+
- name: Build and push image
57+
uses: docker/build-push-action@v6
58+
with:
59+
context: .
60+
push: ${{ github.event_name != 'pull_request' || steps.fork.outputs.is_fork_pr == 'false' }}
61+
sbom: true
62+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.tag }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: Release Drafter Action
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: release-drafter/release-drafter@v6
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)