-
Notifications
You must be signed in to change notification settings - Fork 198
159 lines (155 loc) · 4.63 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Release
on:
push:
branches:
- master
- main
tags:
- '[0-9]+.[0-9]+.[0-9]+'
paths-ignore:
- 'docs/**'
- 'deploy/**'
- 'examples/**'
- 'test/**'
- '*.md'
- '*.yaml'
jobs:
build:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
cache-dependency-path: go.sum
- name: Run Lint and Test Coverage
shell: bash
run: |
make lint
make test-coverage
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ".cover/coverage.xml"
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build Release Binaries
env:
GOPROXY: https://proxy.golang.org
CGO_ENABLED: 0
run: |
make release
- name: Debug Directory Contents
run: |
echo "Current working directory:"
pwd
echo "Listing contents of .bin/ recursively:"
find .bin/ -type f -ls || echo "No files found in .bin/"
echo "Directory structure:"
ls -laR .bin/ || echo "Directory .bin/ is empty or does not exist"
echo "Testing glob expansion:"
ls .bin/* || echo "Glob .bin/* found no files"
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: pumba-binaries
path: .bin/*
retention-days: 7
compression-level: 6
include-hidden-files: true
create-release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
name: Create GitHub Release
needs: [ build ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: pumba-binaries
path: ${{ github.workspace }}/.bin/
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: "Automated release for ${{ github.ref_name }}"
generateReleaseNotes: true
prerelease: true
artifacts: ${{ github.workspace }}/.bin/*
allowUpdates: false
commit: ${{ github.sha }}
draft: false
removeArtifacts: false
replacesArtifacts: true
push-docker:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
name: Push Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Tag Name
id: get_tag
run: echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Get Short SHA
id: short_sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
platforms: linux/amd64,linux/arm64
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_ACCOUNT }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_ORG }}/pumba
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
file: docker/Dockerfile
context: .
build-args: |
BRANCH=${{ github.ref_name }}
COMMIT=${{ steps.short_sha.outputs.sha }}
SKIP_TESTS=true
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: true
sbom: true