@@ -2,7 +2,7 @@ name: Build and Release
22
33on :
44 push :
5- branches : [main]
5+ branches : [main, dev ]
66 tags :
77 - " v*"
88 pull_request :
1818 run : |
1919 apk add --no-cache git make gcc musl-dev
2020
21- - uses : actions/checkout@v3
21+ - name : Checkout code
22+ uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 0
2225
2326 - name : Configure Git safe directory
2427 run : |
@@ -37,20 +40,23 @@ jobs:
3740 if : startsWith(github.ref, 'refs/tags/v')
3841 runs-on : ubuntu-latest
3942 steps :
40- - uses : actions/checkout@v3
43+ - name : Checkout code
44+ uses : actions/checkout@v4
45+ with :
46+ fetch-depth : 0
4147
4248 - name : Set up Docker Buildx
43- uses : docker/setup-buildx-action@v2
49+ uses : docker/setup-buildx-action@v3
4450
4551 - name : Login to DockerHub
46- uses : docker/login-action@v2
52+ uses : docker/login-action@v3
4753 with :
4854 username : ${{ secrets.DOCKERHUB_USERNAME }}
4955 password : ${{ secrets.DOCKERHUB_TOKEN }}
5056
5157 - name : Extract metadata for Docker
5258 id : meta
53- uses : docker/metadata-action@v4
59+ uses : docker/metadata-action@v5
5460 with :
5561 images : hetuproject/checkpoint-dispatcher,hetuproject/checkpoint-validator
5662 tags : |
@@ -59,26 +65,26 @@ jobs:
5965 type=sha
6066
6167 - name : Build and push dispatcher image
62- uses : docker/build-push-action@v4
68+ uses : docker/build-push-action@v5
6369 with :
6470 context : .
6571 file : ./docker/dispatcher/Dockerfile
6672 push : true
6773 tags : hetuproject/checkpoint-dispatcher:${{ steps.meta.outputs.version }},hetuproject/checkpoint-dispatcher:latest
6874 cache-from : type=registry,ref=hetuproject/checkpoint-dispatcher:buildcache
6975 cache-to : type=registry,ref=hetuproject/checkpoint-dispatcher:buildcache,mode=max
70- platforms : linux/amd64,linux/arm64
76+ platforms : linux/amd64
7177
7278 - name : Build and push validator image
73- uses : docker/build-push-action@v4
79+ uses : docker/build-push-action@v5
7480 with :
7581 context : .
7682 file : ./docker/validator/Dockerfile
7783 push : true
7884 tags : hetuproject/checkpoint-validator:${{ steps.meta.outputs.version }},hetuproject/checkpoint-validator:latest
7985 cache-from : type=registry,ref=hetuproject/checkpoint-validator:buildcache
8086 cache-to : type=registry,ref=hetuproject/checkpoint-validator:buildcache,mode=max
81- platforms : linux/amd64,linux/arm64
87+ platforms : linux/amd64
8288
8389 release :
8490 needs : build
9197 run : |
9298 apk add --no-cache git make gcc musl-dev zip tar
9399
94- - uses : actions/checkout@v3
100+ - name : Checkout code
101+ uses : actions/checkout@v4
102+ with :
103+ fetch-depth : 0
95104
96105 - name : Configure Git safe directory
97106 run : |
@@ -100,16 +109,12 @@ jobs:
100109 - name : Build binaries
101110 run : |
102111 # Build for multiple platforms
103- mkdir -p build/linux/amd64 build/linux/arm64 build/ darwin/amd64 build/windows/amd64
112+ mkdir -p build/linux/amd64 build/darwin/amd64 build/windows/amd64
104113
105114 # Linux amd64
106115 CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o build/linux/amd64/dispatcher ./cmd/dispatcher
107116 CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o build/linux/amd64/validator ./cmd/validator
108117
109- # Linux arm64
110- CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -a -installsuffix cgo -o build/linux/arm64/dispatcher ./cmd/dispatcher
111- CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -a -installsuffix cgo -o build/linux/arm64/validator ./cmd/validator
112-
113118 # macOS (Darwin)
114119 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/darwin/amd64/dispatcher ./cmd/dispatcher
115120 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/darwin/amd64/validator ./cmd/validator
@@ -122,25 +127,22 @@ jobs:
122127 run : |
123128 mkdir -p release
124129 cd build/linux/amd64 && tar -czvf ../../../release/checkpoint-linux-amd64.tar.gz * && cd -
125- cd build/linux/arm64 && tar -czvf ../../../release/checkpoint-linux-arm64.tar.gz * && cd -
126130 cd build/darwin/amd64 && tar -czvf ../../../release/checkpoint-darwin-amd64.tar.gz * && cd -
127131 cd build/windows/amd64 && zip -r ../../../release/checkpoint-windows-amd64.zip * && cd -
128132
129- - name : Upload artifacts
130- uses : actions/upload-artifact@v3
131- with :
132- name : release-binaries
133- path : release/
133+ # use GitHub CLI to replace actions/upload-artifact
134+ - name : Install GitHub CLI
135+ run : |
136+ apk add --no-cache github-cli
134137
135- - name : Create Release
136- uses : softprops/action-gh-release@v1
137- with :
138- files : |
139- release/checkpoint-linux-amd64.tar.gz
140- release/checkpoint-linux-arm64.tar.gz
141- release/checkpoint-darwin-amd64.tar.gz
142- release/checkpoint-windows-amd64.zip
143- draft : false
144- prerelease : false
138+ - name : Create GitHub Release
145139 env :
146140 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
141+ run : |
142+ VERSION=${GITHUB_REF#refs/tags/}
143+ gh release create $VERSION \
144+ --title "Release $VERSION" \
145+ --notes "Release $VERSION" \
146+ release/checkpoint-linux-amd64.tar.gz \
147+ release/checkpoint-darwin-amd64.tar.gz \
148+ release/checkpoint-windows-amd64.zip
0 commit comments