File tree Expand file tree Collapse file tree 5 files changed +64
-5
lines changed Expand file tree Collapse file tree 5 files changed +64
-5
lines changed Original file line number Diff line number Diff line change 1+ name : Publish (main)
2+
3+ on :
4+ push :
5+ branches : main
6+
7+ jobs :
8+ image :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Set up QEMU
12+ uses : docker/setup-qemu-action@v1
13+ - name : Set up Docker Buildx
14+ uses : docker/setup-buildx-action@v1
15+ - name : Login to ghcr.io
16+ uses : docker/login-action@v1
17+ with :
18+ registry : ghcr.io
19+ username : ${{ github.repository_owner }}
20+ password : ${{ secrets.GITHUB_TOKEN }}
21+ - name : Checkout
22+ uses : actions/checkout@v2
23+ - name : Modify Dockerfile
24+ run : |
25+ sed -i -e "s|%VERSION%|latest|g" Dockerfile
26+ - name : Build and push
27+ id : docker_build_master
28+ uses : docker/build-push-action@v2
29+ with :
30+ context : .
31+ push : true
32+ tags : ghcr.io/snorwin/haproxy:latest
33+ platforms : linux/amd64
34+ build-args : |
35+ VERSION=main
36+ HASH=${{ github.sha }}
37+ - name : Prune ghcr images
38+ uses : vlaurin/action-ghcr-prune@main
39+ with :
40+ token : ${{ secrets.PRUNE_IMAGE_TOKEN }}
41+ container : ${{github.event.repository.name}}
42+ dry-run : false
43+ older-than : 7
44+ keep-last : 2
45+ untagged : true
46+ keep-tags-regexes : (latest|alpine|2.5|2.5-alpine|2.5.5|2.5.5-alpine)
Original file line number Diff line number Diff line change 1- name : Publish
1+ name : Publish Release
22
33on :
4- push :
5- branches : main
64 release :
75 types :
86 - published
3634 context : .
3735 push : true
3836 tags : ghcr.io/snorwin/haproxy:${{ matrix.tag }}
39- platforms : linux/amd64
37+ platforms : linux/amd64
38+ build-args : |
39+ VERSION=${{ github.event.release.tag_name }}
40+ HASH=${{ github.sha }}
Original file line number Diff line number Diff line change 3333 push : true
3434 tags : ghcr.io/snorwin/haproxy:${{ github.sha }}
3535 platforms : linux/amd64
36+ build-args : |
37+ VERSION=test
38+ HASH=${{ github.sha }}
3639 test :
3740 needs : image
3841 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 11FROM golang:1.17.8-alpine3.15 as builder
2+ ARG VERSION
3+ ARG HASH
24
35RUN mkdir /build
46WORKDIR /build
57COPY .. .
6- RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -a -o haproxy-reload-wrapper .
8+ RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.Version=${VERSION} -X main.Hash=${HASH}" - a -o haproxy-reload-wrapper .
79
810FROM docker.io/haproxy:%VERSION%
911
Original file line number Diff line number Diff line change @@ -13,7 +13,14 @@ import (
1313 "github.com/snorwin/haproxy-reload-wrapper/pkg/utils"
1414)
1515
16+ var (
17+ Version = "v0.0.0"
18+ Hash = ""
19+ )
20+
1621func main () {
22+ log .Notice (fmt .Sprintf ("haproxy-reload-wrapper version is %s-%s" , Version , Hash ))
23+
1724 // fetch the absolut path of the haproxy executable
1825 executable , err := utils .LookupExecutablePathAbs ("haproxy" )
1926 if err != nil {
You can’t perform that action at this time.
0 commit comments