abgen: standalone Decentraland asset-bundle converter + ab-cdn parity… #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: image | |
| on: | |
| push: | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| group: image-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| image: | |
| name: build + push (nix) | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22 | |
| with: | |
| extra-conf: | | |
| max-jobs = auto | |
| cores = 0 | |
| - uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7 | |
| with: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', 'Cargo.lock') }} | |
| restore-prefixes-first-match: nix-${{ runner.os }}- | |
| - name: build image | |
| run: | | |
| ref="${GITHUB_REF_NAME:-dev}" | |
| sha="$(git rev-parse --short HEAD)" | |
| echo "::group::nix build .#dockerImage — ${GITHUB_REPOSITORY} @ ${ref} (${sha})" | |
| nix build .#dockerImage --print-build-logs | |
| echo "store path : $(readlink -f result)" | |
| echo "compressed : $(ls -lLh result | awk '{print $5}')" | |
| echo "layers : $(zcat result | tar -xO manifest.json | grep -o '"[a-f0-9]*/layer.tar"' | wc -l)" | |
| echo "::endgroup::" | |
| { | |
| echo "REF=${ref}" | |
| echo "IMG_SIZE=$(ls -lLh result | awk '{print $5}')" | |
| } >> "$GITHUB_ENV" | |
| - name: push to ghcr | |
| run: | | |
| repo="${GITHUB_REPOSITORY,,}" | |
| conf="$(mktemp)" | |
| echo 'unqualified-search-registries = []' > "$conf" | |
| for tag in "${REF}" latest; do | |
| echo "::group::push ghcr.io/${repo}:${tag}" | |
| nix run nixpkgs#skopeo -- --registries-conf "$conf" --insecure-policy copy \ | |
| --dest-creds "${{ github.actor }}:${{ github.token }}" \ | |
| "docker-archive:$(readlink -f result)" \ | |
| "docker://ghcr.io/${repo}:${tag}" | |
| echo "::endgroup::" | |
| done | |
| { | |
| echo "### abgen container image" | |
| echo "" | |
| echo "| | |" | |
| echo "|---|---|" | |
| echo "| image | \`ghcr.io/${repo}:${REF}\` (and \`:latest\`) |" | |
| echo "| size | ${IMG_SIZE} compressed, no base OS |" | |
| echo "| build | \`nix build .#dockerImage\` — deterministic, pinned \`flake.lock\` |" | |
| } >> "$GITHUB_STEP_SUMMARY" |