Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a566998180 | |||
| 1239cc5673 |
@@ -326,3 +326,31 @@ jobs:
|
||||
run: |
|
||||
source /tmp/build-ctx/build.env
|
||||
bash scripts/report-status.sh failure "Tag $NEXT_VERSION FAILED" ci-docker-tag
|
||||
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [tag-commit]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Delete build artifacts
|
||||
run: |
|
||||
echo "Siivotaan artifactit..."
|
||||
RUN_ID="${{ github.run_id }}"
|
||||
REPO="${{ github.repository }}"
|
||||
SERVER="${{ gitea.server_url }}"
|
||||
|
||||
# List artifacts for this run
|
||||
ARTIFACTS=$(curl -s \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"${SERVER}/api/v1/repos/${REPO}/actions/runs/${RUN_ID}/artifacts")
|
||||
|
||||
echo "Artifacts: $(echo "$ARTIFACTS" | jq -r '.artifacts | length') kpl"
|
||||
|
||||
# Delete each by name
|
||||
echo "$ARTIFACTS" | jq -r '.artifacts[] | .name' | while IFS= read -r name; do
|
||||
echo "Deleting: $name"
|
||||
curl -s -X DELETE \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"${SERVER}/api/v1/repos/${REPO}/actions/runs/${RUN_ID}/artifacts/${name}"
|
||||
echo " -> deleted $name"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user