@@ -122,12 +122,26 @@ jobs:
122122 with :
123123 username : ${{ secrets.REGISTRY_USERNAME }}
124124 password : ${{ secrets.REGISTRY_PASSWORD }}
125+ - name : Set VERSION
126+ run : |
127+ if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
128+ export VERSION=${GITHUB_REF_NAME:1}
129+ elif [ "${GITHUB_EVENT_NAME}" == "schedule" ]; then
130+ export VERSION="${REF}"
131+ else
132+ export VERSION=${GITHUB_SHA}
133+ fi
134+
135+ echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
136+ env :
137+ REF : ${{ needs.prepare.outputs.ref }}
125138 - name : Build
126139 id : build
127140 uses : docker/bake-action@v6
128141 with :
129142 pull : true
130143 load : ${{ !fromJson(needs.prepare.outputs.push) || matrix.debug || matrix.mimalloc }}
144+ source : .
131145 targets : static-builder-musl
132146 set : |
133147 ${{ matrix.debug && 'static-builder-musl.args.DEBUG_SYMBOLS=1' || '' }}
@@ -141,7 +155,6 @@ jobs:
141155 ${{ (fromJson(needs.prepare.outputs.push) && !matrix.debug && !matrix.mimalloc) && format('*.output=type=image,name={0},push-by-digest=true,name-canonical=true,push=true', env.IMAGE_NAME) || '' }}
142156 env :
143157 SHA : ${{ github.sha }}
144- VERSION : ${{ (github.ref_type == 'tag' && github.ref_name) || needs.prepare.outputs.ref || 'dev' }}
145158 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
146159 - # Workaround for https://github.com/actions/runner/pull/2477#issuecomment-1501003600
147160 name : Export metadata
@@ -214,6 +227,34 @@ jobs:
214227 runs-on : ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
215228 needs : [prepare]
216229 steps :
230+ # Inspired by https://gist.github.com/antiphishfish/1e3fbc3f64ef6f1ab2f47457d2da5d9d and https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh
231+ - name : Free disk space
232+ run : |
233+ set -xe
234+ sudo rm -rf /usr/share/dotnet
235+ sudo rm -rf /usr/share/swift
236+ sudo rm -rf /usr/local/lib/android
237+ sudo rm -rf /opt/ghc
238+ sudo rm -rf /usr/local/.ghcup
239+ sudo rm -rf "/usr/local/share/boost"
240+ sudo rm -rf "$AGENT_TOOLSDIRECTORY"
241+ sudo rm -rf /opt/hostedtoolcache/
242+ sudo rm -rf /usr/local/graalvm/
243+ sudo rm -rf /usr/local/share/powershell
244+ sudo rm -rf /usr/local/share/chromium
245+ sudo rm -rf /usr/local/lib/node_modules
246+ sudo docker image prune --all --force
247+
248+ APT_PARAMS='sudo apt -y -qq -o=Dpkg::Use-Pty=0'
249+ $APT_PARAMS remove -y '^dotnet-.*'
250+ $APT_PARAMS remove -y '^llvm-.*'
251+ $APT_PARAMS remove -y '^php.*'
252+ $APT_PARAMS remove -y '^mongodb-.*'
253+ $APT_PARAMS remove -y '^mysql-.*'
254+ $APT_PARAMS remove -y azure-cli firefox powershell mono-devel libgl1-mesa-dri
255+ $APT_PARAMS autoremove --purge -y
256+ $APT_PARAMS autoclean
257+ $APT_PARAMS clean
217258 - name : Prepare
218259 id : prepare
219260 run : echo "sanitized_platform=${PLATFORM//\//-}" >> "${GITHUB_OUTPUT}"
@@ -223,6 +264,19 @@ jobs:
223264 with :
224265 ref : ${{ needs.prepare.outputs.ref }}
225266 persist-credentials : false
267+ - name : Set VERSION
268+ run : |
269+ if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
270+ export VERSION=${GITHUB_REF_NAME:1}
271+ elif [ "${GITHUB_EVENT_NAME}" == "schedule" ]; then
272+ export VERSION="${REF}"
273+ else
274+ export VERSION=${GITHUB_SHA}
275+ fi
276+
277+ echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
278+ env :
279+ REF : ${{ needs.prepare.outputs.ref }}
226280 - name : Set up Docker Buildx
227281 uses : docker/setup-buildx-action@v3
228282 with :
@@ -239,6 +293,7 @@ jobs:
239293 with :
240294 pull : true
241295 load : ${{ !fromJson(needs.prepare.outputs.push) }}
296+ source : .
242297 targets : static-builder-gnu
243298 set : |
244299 ${{ (github.event_name == 'pull_request' || matrix.platform == 'linux/arm64') && 'static-builder-gnu.args.NO_COMPRESS=1' || '' }}
@@ -251,7 +306,6 @@ jobs:
251306 ${{ fromJson(needs.prepare.outputs.push) && format('*.output=type=image,name={0},push-by-digest=true,name-canonical=true,push=true', env.IMAGE_NAME) || '' }}
252307 env :
253308 SHA : ${{ github.sha }}
254- VERSION : ${{ (github.ref_type == 'tag' && github.ref_name) || needs.prepare.outputs.ref || 'dev' }}
255309 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
256310 - # Workaround for https://github.com/actions/runner/pull/2477#issuecomment-1501003600
257311 name : Export metadata
0 commit comments