Skip to content

Commit da3df80

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

File tree

2 files changed

+51
-39
lines changed

2 files changed

+51
-39
lines changed

.github/workflows/docker.yaml

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,46 @@ jobs:
1919
build:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
22+
- name: Checkout
23+
uses: actions/checkout@v4
2424

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' }}
25+
- name: Figure out if running fork PR
26+
id: fork
27+
run: >-
28+
["${{ secrets.DOCKER_REGISTRY_TOKEN }}" == ""] &&
29+
echo "is_fork_pr=true" >> $GITHUB_ENV ||
30+
echo "is_fork_pr=false" >> $GITHUB_ENV
31+
if: ${{ github.event_name == 'pull_request' }}
2932

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' }}
33+
- name: Docker Login
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ secrets.DOCKER_REGISTRY }}
37+
username: ${{ secrets.DOCKER_REGISTRY_USER }}
38+
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
39+
if: ${{ github.event_name != 'pull_request' || steps.fork.outputs.is_fork_pr == 'false' }}
3740

38-
- name: Set up Go 1.24
39-
uses: actions/setup-go@v5
40-
with:
41-
go-version: '1.24.x'
41+
- name: Set up Go 1.24
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: '1.24.x'
4245

43-
- name: Lint
44-
uses: golangci/golangci-lint-action@v7
46+
- name: Lint
47+
uses: golangci/golangci-lint-action@v7
4548

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
49+
- name: Make tag
50+
run: |
51+
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=pr-${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
52+
[ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
53+
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=latest" >> $GITHUB_ENV || true
5154
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+
- name: Set up Docker Buildx
56+
uses: docker/setup-buildx-action@v3
5557

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' }}
58+
- name: Build and push image
59+
uses: docker/build-push-action@v6
60+
with:
61+
context: .
62+
push: ${{ github.event_name != 'pull_request' || steps.fork.outputs.is_fork_pr == 'false' }}
63+
sbom: true
64+
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)