|
32 | 32 | - name: Checkout repository |
33 | 33 | uses: actions/checkout@v4 |
34 | 34 |
|
| 35 | + - name: Clean up disk space |
| 36 | + uses: jlumbroso/free-disk-space@main |
| 37 | + |
35 | 38 | # Install the cosign tool except on PR |
36 | 39 | # https://github.com/sigstore/cosign-installer |
37 | 40 | - name: Install cosign |
@@ -77,30 +80,29 @@ jobs: |
77 | 80 | cache-from: type=gha |
78 | 81 | cache-to: type=gha,mode=max |
79 | 82 |
|
80 | | - # Sign the resulting Docker image digest except on PRs. |
81 | | - # This will only write to the public Rekor transparency log when the Docker |
82 | | - # repository is public to avoid leaking data. If you would like to publish |
83 | | - # transparency data even for private images, pass --force to cosign below. |
84 | | - # https://github.com/sigstore/cosign |
85 | | - - name: Sign the published Docker image |
86 | | - if: ${{ github.event_name != 'pull_request' }} |
87 | | - env: |
88 | | - # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable |
89 | | - TAGS: ${{ steps.meta.outputs.tags }} |
90 | | - DIGEST: ${{ steps.build-and-push.outputs.digest }} |
91 | | - # This step uses the identity token to provision an ephemeral certificate |
92 | | - # against the sigstore community Fulcio instance. |
93 | | - run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |
| 83 | + - name: Free disk space after Docker build |
| 84 | + run: | |
| 85 | + docker buildx ls --format '{{.Name}}' | grep -v default | xargs -I {} docker buildx rm {} 2>/dev/null || true |
| 86 | + docker system prune -af --volumes |
| 87 | + docker builder prune -af |
| 88 | +
|
| 89 | + rm -rf ~/.docker/buildx || true |
| 90 | + rm -rf /tmp/docker-actions-toolkit-*/* 2>/dev/null || true |
| 91 | +
|
| 92 | + df -h / |
| 93 | +
|
| 94 | + - id: lower-repo |
| 95 | + name: Repository to lowercase |
| 96 | + run: | |
| 97 | + echo "repository=${GITHUB_REPOSITORY@L}" >> $GITHUB_OUTPUT |
94 | 98 |
|
95 | 99 | # Build and push .sif files for Apptainer |
96 | | - - name: Clean up disk space |
97 | | - uses: jlumbroso/free-disk-space@main |
98 | 100 | - name: Setup Apptainer |
99 | 101 | uses: eWaterCycle/setup-apptainer@v2 |
100 | 102 | - name: Build and push Apptainer |
101 | 103 | env: |
102 | 104 | TAGS: ${{ steps.meta.outputs.tags }} |
103 | 105 | run: | |
104 | 106 | echo ${{ secrets.GITHUB_TOKEN }} | apptainer registry login -u ${{ secrets.GHCR_USERNAME }} --password-stdin docker://ghcr.io |
105 | | - apptainer build container.sif docker://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest |
| 107 | + apptainer build container.sif docker://${{ env.REGISTRY }}/${{ steps.lower-repo.outputs.repository }}:latest |
106 | 108 | echo "${TAGS}" | xargs -I {} apptainer push container.sif oras://{}-sif |
0 commit comments