Skip to content

Commit 819c4c7

Browse files
authored
Merge pull request #119 from rabbitmq/update-ci
Update workflow
2 parents d5a6171 + 3bac53a commit 819c4c7

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

.github/workflows/build-test-publish.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,45 @@ name: Build, Test, & Publish
33
on:
44
push:
55
branches: [ main ]
6+
paths-ignore:
7+
- "**.md"
8+
- "LICENSE"
69
pull_request:
710
branches: [ main ]
8-
9-
env:
10-
GO_VERSION: ~1.22
11+
paths-ignore:
12+
- "**.md"
13+
- "LICENSE"
1114

1215
jobs:
1316
unit_tests:
14-
name: unit tests
17+
name: Unit tests
1518
runs-on: ubuntu-latest
1619
steps:
1720
- uses: actions/checkout@v4
21+
1822
- name: Setup Go
1923
uses: actions/setup-go@v5
2024
with:
21-
go-version: ${{ env.GO_VERSION }}
22-
check-latest: true
25+
go-version-file: go.mod
26+
2327
- name: Unit tests
2428
run: go test -v ./...
29+
2530
build_dev_image:
26-
name: build dev image
31+
name: Build dev image
2732
runs-on: ubuntu-latest
2833
needs: unit_tests
2934
permissions:
3035
contents: 'write'
3136
id-token: 'write'
3237
steps:
3338
- uses: actions/checkout@v4
39+
3440
- name: Setup Go
3541
uses: actions/setup-go@v5
3642
with:
37-
go-version: ${{ env.GO_VERSION }}
38-
check-latest: true
43+
go-version-file: go.mod
44+
3945
- name: OCI Metadata for multi-arch image
4046
id: meta
4147
uses: docker/metadata-action@v5
@@ -46,28 +52,35 @@ jobs:
4652
type=sha
4753
type=ref,event=pr
4854
type=semver,pattern={{version}}
55+
4956
- uses: docker/setup-qemu-action@v3
57+
5058
- uses: docker/setup-buildx-action@v3
51-
- if: github.event_name != 'pull_request'
52-
uses: docker/login-action@v3
59+
60+
- uses: docker/login-action@v3
61+
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
5362
with:
5463
username: ${{ secrets.DOCKERHUB_USERNAME }}
5564
password: ${{ secrets.DOCKERHUB_TOKEN }}
65+
66+
# We want to always build the image, and push to registry only on new tag i.e. new release
5667
- name: Build and push
5768
uses: docker/build-push-action@v6
5869
with:
5970
context: .
6071
platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x
61-
push: ${{ github.event_name != 'pull_request' }}
72+
push: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
6273
tags: ${{ steps.meta.outputs.tags }}
6374
labels: ${{ steps.meta.outputs.labels }}
75+
6476
release:
6577
name: Release to GitHub Releases
66-
runs-on: ubunut-latest
78+
runs-on: ubuntu-latest
6779
if: startsWith(github.ref, 'refs/tags/v')
6880
needs: [ unit_tests, build_dev_image ]
6981
steps:
7082
- uses: actions/checkout@v4
83+
7184
- name: Release
7285
uses: softprops/action-gh-release@v2
7386
if: startsWith(github.ref, 'refs/tags/v')

0 commit comments

Comments
 (0)