fix: wrong iceflow package name in flake for docker build #87
This file contains 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: Build Container Images for Examples | |
on: | |
push: | |
branches: [ 'main' ] | |
release: | |
env: | |
REGISTRY: ghcr.io/${{ github.repository }} | |
REGISTRY_USER: ${{ github.actor }} | |
REGISTRY_PASS: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
packages: write | |
jobs: | |
build-container-images: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
architecture: ["x86_64-linux", "aarch64-linux"] | |
steps: | |
- name: Set up QEMU for cross-compilation | |
if: ${{ matrix.architecture != 'x86_64-linux' }} | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: "arm64" | |
- uses: actions/checkout@v4 | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: skopeo | |
version: 1.0 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Build text2lines image | |
run: | | |
echo TEXT2LINES_IMAGE=$(nix build '.#docker-text2lines-cross.${{ matrix.architecture }}' --print-out-paths) >> "$GITHUB_ENV" | |
- name: Build lines2words image | |
run: | | |
echo LINES2WORDS_IMAGE=$(nix build '.#docker-lines2words-cross.${{ matrix.architecture }}' --print-out-paths) >> "$GITHUB_ENV" | |
- name: Build wordcount image | |
run: | | |
echo WORDCOUNT_IMAGE=$(nix build '.#docker-wordcount-cross.${{ matrix.architecture }}' --print-out-paths) >> "$GITHUB_ENV" | |
- name: Push image | |
if: ${{ github.ref != 'main' }} | |
run: | | |
export BRANCH_NAME=$(bash -c "echo $GITHUB_REF_NAME | sed -r 's,/,_,g'") | |
skopeo copy --all --dest-creds="$REGISTRY_USER:$REGISTRY_PASS" docker-archive:$TEXT2LINES_IMAGE docker://$REGISTRY/iceflow-examples/text2lines/$INPUT_ARCH:$BRANCH_NAME | |
skopeo copy --all --dest-creds="$REGISTRY_USER:$REGISTRY_PASS" docker-archive:$LINES2WORDS_IMAGE docker://$REGISTRY/iceflow-examples/lines2words/$INPUT_ARCH:$BRANCH_NAME | |
skopeo copy --all --dest-creds="$REGISTRY_USER:$REGISTRY_PASS" docker-archive:$WORDCOUNT_IMAGE docker://$REGISTRY/iceflow-examples/wordcount/$INPUT_ARCH:$BRANCH_NAME | |
env: | |
INPUT_ARCH: ${{ ( matrix.architecture == 'x86_64-linux' && 'amd64' ) || ( matrix.architecture == 'aarch64-linux' && 'arm64' ) }} | |
- name: Push image (and update latest tag) | |
if: ${{ github.ref == 'main' }} | |
run: | | |
export BRANCH_NAME=$(bash -c "echo $GITHUB_REF_NAME | sed -r 's,/,_,g'") | |
skopeo copy --all --additional-tags=latest --dest-creds="$REGISTRY_USER:$REGISTRY_PASS" docker-archive:$TEXT2LINES_IMAGE docker://$REGISTRY/iceflow-examples/text2lines/$INPUT_ARCH:$BRANCH_NAME | |
skopeo copy --all --additional-tags=latest --dest-creds="$REGISTRY_USER:$REGISTRY_PASS" docker-archive:$LINES2WORDS_IMAGE docker://$REGISTRY/iceflow-examples/lines2words/$INPUT_ARCH:$BRANCH_NAME | |
skopeo copy --all --additional-tags=latest --dest-creds="$REGISTRY_USER:$REGISTRY_PASS" docker-archive:$WORDCOUNT_IMAGE docker://$REGISTRY/iceflow-examples/wordcount/$INPUT_ARCH:$BRANCH_NAME | |
env: | |
INPUT_ARCH: ${{ ( matrix.architecture == 'x86_64-linux' && 'amd64' ) || ( matrix.architecture == 'aarch64-linux' && 'arm64' ) }} | |
build-multiarch-manifest: | |
runs-on: ubuntu-latest | |
needs: [ "build-container-images" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Upload manifest | |
if: ${{ github.ref != 'main' }} | |
run: | | |
export BRANCH_NAME=$(bash -c "echo $GITHUB_REF_NAME | sed -r 's,/,_,g'") | |
nix develop --impure .#ci -c manifest-tool --username $REGISTRY_USER --password $REGISTRY_PASS push from-args --platforms linux/amd64,linux/arm64 --template $REGISTRY/iceflow-examples/text2lines/ARCH:$BRANCH_NAME --target $REGISTRY/iceflow-examples/text2lines:$BRANCH_NAME | |
nix develop --impure .#ci -c manifest-tool --username $REGISTRY_USER --password $REGISTRY_PASS push from-args --platforms linux/amd64,linux/arm64 --template $REGISTRY/iceflow-examples/lines2words/ARCH:$BRANCH_NAME --target $REGISTRY/iceflow-examples/lines2words:$BRANCH_NAME | |
nix develop --impure .#ci -c manifest-tool --username $REGISTRY_USER --password $REGISTRY_PASS push from-args --platforms linux/amd64,linux/arm64 --template $REGISTRY/iceflow-examples/wordcount/ARCH:$BRANCH_NAME --target $REGISTRY/iceflow-examples/wordcount:$BRANCH_NAME | |
- name: Upload manifest (and update latest tag) | |
if: ${{ github.ref == 'main' }} | |
run: | | |
export BRANCH_NAME=$(bash -c "echo $GITHUB_REF_NAME | sed -r 's,/,_,g'") | |
nix develop --impure .#ci -c manifest-tool --username $REGISTRY_USER --password $REGISTRY_PASS push from-args --platforms linux/amd64,linux/arm64 --template $REGISTRY/iceflow-examples/text2lines/ARCH:$BRANCH_NAME --tags latest --target $REGISTRY/iceflow-examples/text2lines:$BRANCH_NAME | |
nix develop --impure .#ci -c manifest-tool --username $REGISTRY_USER --password $REGISTRY_PASS push from-args --platforms linux/amd64,linux/arm64 --template $REGISTRY/iceflow-examples/lines2words/ARCH:$BRANCH_NAME --tags latest --target $REGISTRY/iceflow-examples/lines2words:$BRANCH_NAME | |
nix develop --impure .#ci -c manifest-tool --username $REGISTRY_USER --password $REGISTRY_PASS push from-args --platforms linux/amd64,linux/arm64 --template $REGISTRY/iceflow-examples/wordcount/ARCH:$BRANCH_NAME --tags latest --target $REGISTRY/iceflow-examples/wordcount:$BRANCH_NAME |