Skip to content

Commit 6cc06d0

Browse files
committed
fix release workflow
1 parent 1ea7e3f commit 6cc06d0

File tree

1 file changed

+49
-47
lines changed

1 file changed

+49
-47
lines changed

.github/workflows/release.yaml

+49-47
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Release"
1+
name: Release
22

33
on:
44
push:
@@ -21,124 +21,126 @@ jobs:
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: read
24-
2524
steps:
26-
- name: Checkout code
25+
- name: Checkout Code
2726
uses: actions/checkout@v4
2827
with:
2928
fetch-depth: 0
30-
31-
- name: Set up Go
29+
- name: Set Up Go
3230
uses: actions/setup-go@v5
3331
with:
3432
go-version: '1.21'
3533
cache: true
36-
37-
- name: Build release binaries
34+
cache-dependency-path: go.sum
35+
- name: Build Release Binaries
3836
env:
3937
GOPROXY: https://proxy.golang.org
4038
CGO_ENABLED: 0
4139
run: |
4240
make release
43-
44-
- name: Upload build artifacts
41+
- name: Upload Build Artifacts
4542
uses: actions/upload-artifact@v4
4643
with:
47-
name: 'pumba-binaries'
44+
name: pumba-binaries
4845
path: .bin/**
4946
retention-days: 7
47+
compression-level: 6
5048

5149
create-release:
5250
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
5351
name: Create GitHub Release
5452
needs: [ build ]
5553
runs-on: ubuntu-latest
5654
permissions:
57-
contents: write # Required for creating releases
58-
55+
contents: write
5956
steps:
60-
- name: Checkout code
57+
- name: Checkout Code
6158
uses: actions/checkout@v4
62-
63-
- name: Get tag name
59+
with:
60+
fetch-depth: 0
61+
- name: Get Tag Name
6462
id: get_tag
6563
run: echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
66-
67-
- name: Download artifacts
64+
- name: Download Artifacts
6865
uses: actions/download-artifact@v4
6966
with:
70-
name: 'pumba-binaries'
67+
name: pumba-binaries
7168
path: ${{ github.workspace }}/.bin/
72-
69+
job-id: build
7370
- name: Create GitHub Release
74-
uses: softprops/action-gh-release@v2
71+
id: create_release
72+
uses: actions/create-release@v1
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7575
with:
76-
name: ${{ steps.get_tag.outputs.git_tag }}
7776
tag_name: ${{ steps.get_tag.outputs.git_tag }}
77+
release_name: ${{ steps.get_tag.outputs.git_tag }}
7878
prerelease: true
7979
generate_release_notes: true
80-
files: |
81-
${{ github.workspace }}/.bin/**
80+
- name: Upload Release Assets
81+
uses: actions/upload-release-asset@v1
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
upload_url: ${{ steps.create_release.outputs.upload_url }}
86+
asset_path: ${{ github.workspace }}/.bin/**
87+
asset_name: pumba-binaries-${{ steps.get_tag.outputs.git_tag }}.tar.gz
88+
asset_content_type: application/gzip
8289

8390
push-docker:
8491
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
8592
name: Push Docker Image
8693
runs-on: ubuntu-latest
8794
permissions:
8895
contents: read
89-
packages: write # Required if pushing to GHCR
90-
96+
packages: write
9197
steps:
92-
- name: Checkout code
98+
- name: Checkout Code
9399
uses: actions/checkout@v4
94-
95-
- name: Get tag name
100+
with:
101+
fetch-depth: 0
102+
- name: Get Tag Name
96103
id: get_tag
97104
run: echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
98-
99-
- name: Get short SHA
100-
id: short-sha
105+
- name: Get Short SHA
106+
id: short_sha
101107
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
102-
103-
- name: Set up Docker Buildx
108+
- name: Set Up Docker Buildx
104109
uses: docker/setup-buildx-action@v3
105110
with:
111+
driver: docker-container
106112
platforms: linux/amd64,linux/arm64
107-
108-
- name: Set up QEMU
113+
- name: Set Up QEMU
109114
uses: docker/setup-qemu-action@v3
110-
111-
- name: Login to Docker registry
115+
with:
116+
platforms: linux/amd64,linux/arm64
117+
- name: Login to Docker Registry
112118
uses: docker/login-action@v3
113119
with:
114120
username: ${{ secrets.DOCKER_ACCOUNT }}
115121
password: ${{ secrets.DOCKER_TOKEN }}
116-
117-
- name: Build metadata
122+
- name: Build Metadata
118123
id: meta
119124
uses: docker/metadata-action@v5
120125
with:
121126
images: ${{ secrets.DOCKER_ORG }}/pumba
122127
tags: |
123128
type=semver,pattern={{version}}
124129
type=raw,value=latest
125-
126-
- name: Build and push
127-
uses: docker/build-push-action@v5
130+
- name: Build and Push Docker Image
131+
uses: docker/build-push-action@v6
128132
with:
129133
file: docker/Dockerfile
130134
context: .
131135
build-args: |
132136
BRANCH=${{ github.ref_name }}
133-
COMMIT=${{ steps.short-sha.outputs.sha }}
137+
COMMIT=${{ steps.short_sha.outputs.sha }}
134138
SKIP_TESTS=true
135-
platforms: |
136-
linux/amd64
137-
linux/arm64
139+
platforms: linux/amd64,linux/arm64
138140
push: true
139141
tags: ${{ steps.meta.outputs.tags }}
140142
labels: ${{ steps.meta.outputs.labels }}
141143
cache-from: type=gha
142144
cache-to: type=gha,mode=max
143145
provenance: true
144-
sbom: true
146+
sbom: true

0 commit comments

Comments
 (0)