Skip to content

Commit 8e75ef0

Browse files
authored
Merge pull request #10306 from Roasbeef/free-release-space
build: fix disk space exhaustion in release builds
2 parents a315ad3 + dfee570 commit 8e75ef0

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

.github/actions/cleanup-space/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,31 @@ runs:
88
shell: bash
99
run: |
1010
echo "Removing large toolsets to free up disk space..."
11+
echo "Disk space before cleanup:"
12+
df -h
13+
1114
# Remove dotnet to save disk space.
1215
sudo rm -rf /usr/share/dotnet
1316
# Remove android to save disk space.
1417
sudo rm -rf /usr/local/lib/android
1518
# Remove ghc to save disk space.
1619
sudo rm -rf /opt/ghc
20+
# Remove large packages.
21+
sudo rm -rf /usr/share/swift
22+
sudo rm -rf /usr/local/julia*
23+
sudo rm -rf /opt/hostedtoolcache
24+
25+
# Remove docker images to save space.
26+
docker image prune -a -f || true
27+
28+
# Remove large apt packages.
29+
sudo apt-get remove -y '^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*' azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri 2>/dev/null || true
30+
sudo apt-get autoremove -y
31+
sudo apt-get clean
32+
33+
# Remove caches.
34+
sudo rm -rf /usr/local/share/boost
35+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
36+
37+
echo "Disk space after cleanup:"
38+
df -h

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fetch-depth: 0
2929

3030
- name: cleanup space
31-
run: rm -rf /opt/hostedtoolcache && mkdir -p /opt/hostedtoolcache/go
31+
uses: ./.github/actions/cleanup-space
3232

3333
- name: setup go ${{ env.GO_VERSION }}
3434
uses: actions/setup-go@v5

scripts/release.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ required Go version ($goversion)."
193193
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lncli
194194
popd
195195

196+
# Clear Go build cache to prevent disk space issues during multi-platform builds.
197+
go clean -cache
198+
196199
# Add the hashes for the individual binaries as well for easy verification
197200
# of a single installed binary.
198201
shasum -a 256 "${dir}/"* >> "manifest-$tag.txt"

0 commit comments

Comments
 (0)