Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ‹ Updated Docker workflow actions, improves summary

Alicia Sykes567517b3e41f
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index cad595d5..01837bc4 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -34,7 +34,7 @@ permissions:
contents: read
env:
- DH_IMAGE: ${{ secrets.DOCKER_REPO }}
+ DH_IMAGE: ${{ vars.DOCKER_REPO || 'lissy93/dashy' }}
GH_IMAGE: ghcr.io/${{ github.repository }}
jobs:
@@ -45,6 +45,9 @@ jobs:
contents: read
packages: write
security-events: write
+ env:
+ DOCKER_BUILD_SUMMARY: "false"
+ DOCKER_BUILD_RECORD_UPLOAD: "false"
strategy:
fail-fast: false
matrix:
@@ -135,7 +138,7 @@ jobs:
- name: πŸ“€ Upload Trivy SARIF
if: always() && hashFiles(format('trivy-{0}.sarif', matrix.arch)) != ''
- uses: github/codeql-action/upload-sarif@v3
+ uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: trivy-${{ matrix.arch }}.sarif
category: trivy-${{ matrix.arch }}
@@ -179,7 +182,7 @@ jobs:
id-token: write
attestations: write
env:
- HAS_DH: ${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' && secrets.DOCKER_REPO != '' }}
+ HAS_DH: ${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }}
SEMVER_VALUE: ${{ inputs.tag || github.ref_name }}
SEMVER_ENABLE: ${{ github.event_name == 'push' || inputs.tag != '' }}
LATEST_ENABLE: ${{ inputs.tag == '' }}
@@ -235,8 +238,8 @@ jobs:
for f in *; do SOURCES+=("${GH_IMAGE}@$(cat "$f")"); done
docker buildx imagetools create "${TAGS[@]}" "${SOURCES[@]}"
PRIMARY=$(jq -r --arg img "$GH_IMAGE" \
- '.tags[] | select(startswith($img + ":"))' \
- <<< "$DOCKER_METADATA_OUTPUT_JSON" | head -1)
+ '[.tags[] | select(startswith($img + ":"))] | first // empty' \
+ <<< "$DOCKER_METADATA_OUTPUT_JSON")
DIGEST=$(docker buildx imagetools inspect "$PRIMARY" --format '{{.Manifest.Digest}}')
echo "primary_tag=$PRIMARY" >> "$GITHUB_OUTPUT"
echo "digest=$DIGEST" >> "$GITHUB_OUTPUT"
@@ -251,7 +254,7 @@ jobs:
- name: πŸͺͺ Attest SBOM
id: attest_sbom
- uses: actions/attest-sbom@v4
+ uses: actions/attest@v4
continue-on-error: true
with:
subject-name: ${{ env.GH_IMAGE }}
@@ -276,30 +279,68 @@ jobs:
PROV_OUTCOME: ${{ steps.attest_provenance.outcome }}
PROV_URL: ${{ steps.attest_provenance.outputs.attestation-url }}
DIGEST: ${{ steps.manifest.outputs.digest }}
+ PRIMARY: ${{ steps.manifest.outputs.primary_tag }}
TAGS_JSON: ${{ steps.meta.outputs.json }}
+ DIGESTS_DIR: ${{ runner.temp }}/digests
run: |
+ # Behold, some ugly bash, to produce a pretty output (don't read it, just trust)
set -euo pipefail
- attest() {
- case "$2" in
+
+ attest_line() {
+ local label="$1" outcome="$2" url="$3"
+ case "$outcome" in
success)
- if [ -n "$3" ]; then
- echo "- βœ… $1 attested ([view]($3))"
+ if [ -n "$url" ]; then
+ echo "- βœ… $label attested ([view]($url))"
else
- echo "- βœ… $1 attested"
+ echo "- βœ… $label attested"
fi ;;
- failure) echo "- ⚠️ $1 attestation failed (image pushed without attest)" ;;
- *) echo "- ⏭️ $1 attestation \`$2\`" ;;
+ failure) echo "- ⚠️ $label attestation failed (image pushed without attest)" ;;
+ *) echo "- ⏭️ $label attestation \`$outcome\`" ;;
esac
}
+
+ arch_section() {
+ local arch="$1" file="$DIGESTS_DIR/$arch"
+ [ -f "$file" ] || return 0
+ local digest manifest size count
+ digest=$(cat "$file")
+ manifest=$(docker buildx imagetools inspect "${PRIMARY%%:*}@$digest" --raw 2>/dev/null || echo '{}')
+ size=$(jq '[.layers[]?.size // 0] | add // 0' <<< "$manifest")
+ count=$(jq '.layers // [] | length' <<< "$manifest")
+ echo "#### Dashy \`$arch\`"
+ echo ""
+ echo "- **Digest:** \`$digest\`"
+ [ "$size" != "0" ] && echo "- **Size:** $(numfmt --to=iec --suffix=B "$size" 2>/dev/null || echo "$size B")"
+ [ "$count" != "0" ] && echo "- **Layers:** $count"
+ echo ""
+ }
+
+ # Clear auto-generated "Attestation Created" blocks from attest actions.
+ : > "$GITHUB_STEP_SUMMARY"
{
if [ -n "$DIGEST" ]; then
- echo "## 🐳 Docker Image"
+ echo "## Docker Image"
+ echo ""
echo "**Manifest:** \`$DIGEST\`"
+ echo ""
echo '```bash'
jq -r '.tags[] | "docker pull \(.)"' <<< "$TAGS_JSON"
echo '```'
+ echo ""
+ echo "---"
+ echo ""
fi
- echo "## πŸͺͺ Attestations"
- attest "SBOM" "$SBOM_OUTCOME" "$SBOM_URL"
- attest "Build provenance" "$PROV_OUTCOME" "$PROV_URL"
+ echo "## Attestations"
+ echo ""
+ attest_line "SBOM" "$SBOM_OUTCOME" "$SBOM_URL"
+ attest_line "Build provenance" "$PROV_OUTCOME" "$PROV_URL"
+ echo ""
+ echo "---"
+ echo ""
+ echo "## Build Info"
+ echo ""
+ for arch in amd64 arm64 armv7; do
+ arch_section "$arch"
+ done
} >> "$GITHUB_STEP_SUMMARY"