Skip to content

Commit 504a0c7

Browse files
authored
Fix: docker image tag after release (#442)
* start release pipeline on workflow_dispatch * improve based on pr review * use latest netbox helm chart * remove kind load docker-image * undo helm chart upgrade * upgrade netbox helm chart * load images to kind * fix kind deployment * run on workflow only if success and fetch tags
1 parent 1647786 commit 504a0c7

File tree

6 files changed

+21
-2
lines changed

6 files changed

+21
-2
lines changed

.github/workflows/build-image.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ env:
1717
jobs:
1818
push:
1919
runs-on: ubuntu-latest
20+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run' }}
2021
permissions:
2122
packages: write
2223
contents: read
2324
steps:
2425
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
26+
with:
27+
fetch-tags: true
2528
- name: Set up QEMU
2629
uses: docker/setup-qemu-action@v3
2730
- name: Set up Docker Buildx
@@ -33,6 +36,17 @@ jobs:
3336
registry: ghcr.io
3437
username: ${{ github.actor }}
3538
password: ${{ secrets.GITHUB_TOKEN }}
39+
- name: Get tag information
40+
id: tag_info
41+
run: |
42+
LATEST_TAG=$(git tag --points-at HEAD || echo "no-tag")
43+
44+
# if LATEST_TAG is empty set it to "no-tag"
45+
if [ -z "$LATEST_TAG" ]; then
46+
LATEST_TAG="no-tag"
47+
fi
48+
49+
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
3650
- name: Generate docker image tag
3751
id: meta
3852
uses: docker/[email protected]
@@ -44,8 +58,8 @@ jobs:
4458
# (for all commits) generate a tag named sha-[short sha value]
4559
type=sha,enable=true
4660
# (for tagged commits only) generate tags identical to the git tag version, with and without the leading v
47-
type=semver,pattern={{raw}},enable=${{startsWith(github.ref, 'refs/tags/v')}}
48-
type=semver,pattern={{version}},enable=${{startsWith(github.ref, 'refs/tags/v')}}
61+
type=semver,pattern={{raw}},enable=${{ steps.tag_info.outputs.latest_tag != 'no-tag' }},value=${{ steps.tag_info.outputs.latest_tag }}
62+
type=semver,pattern={{version}},enable=${{ steps.tag_info.outputs.latest_tag != 'no-tag' }},value=${{ steps.tag_info.outputs.latest_tag }}
4963
- name: Build and push
5064
uses: docker/build-push-action@v6
5165
with:

.github/workflows/e2e-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
e2e-tests-3-7-8:
2525
name: Against netbox version 3.7.8
2626
runs-on: ubuntu-latest
27+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run' }}
2728
steps:
2829
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
2930
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0

.github/workflows/govuln.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ permissions: read-all
1515
jobs:
1616
test:
1717
runs-on: ubuntu-latest
18+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run' }}
1819
steps:
1920
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
2021
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0

.github/workflows/integration-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ permissions:
1616
jobs:
1717
test:
1818
runs-on: ubuntu-latest
19+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run' }}
1920
steps:
2021
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
2122
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0

.github/workflows/lint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ permissions: read-all
1515
jobs:
1616
go-and-crds:
1717
runs-on: ubuntu-latest
18+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run' }}
1819
steps:
1920
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
2021
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0

.github/workflows/unit-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ permissions:
1616
jobs:
1717
test:
1818
runs-on: ubuntu-latest
19+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run' }}
1920
steps:
2021
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
2122
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0

0 commit comments

Comments
 (0)