Separate CI job for publishing docker manifest

This commit is contained in:
Tom Foster 2024-04-22 16:07:26 +01:00 committed by June
parent b8a748815a
commit 77d73583f6

View file

@ -1,368 +1,354 @@
name: CI and Artifacts name: CI and Artifacts
on: on:
pull_request: pull_request:
push: push:
branches: branches:
- main - main
- dev - dev
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
env: env:
# Required to make some things output color # Required to make some things output color
TERM: ansi TERM: ansi
# Publishing to my nix binary cache # Publishing to my nix binary cache
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }} ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
# Just in case incremental is still being set to true, speeds up CI # Just in case incremental is still being set to true, speeds up CI
CARGO_INCREMENTAL: 0 CARGO_INCREMENTAL: 0
# Custom nix binary cache if fork is being used # Custom nix binary cache if fork is being used
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }} ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }} ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
permissions: permissions:
packages: write packages: write
contents: read contents: read
jobs: jobs:
tests: tests:
name: CI and Tests name: CI and Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Sync repository - name: Sync repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Nix (with flakes and nix-command enabled) - name: Install Nix (with flakes and nix-command enabled)
uses: cachix/install-nix-action@v26 uses: cachix/install-nix-action@v26
with: with:
nix_path: nixpkgs=channel:nixos-unstable nix_path: nixpkgs=channel:nixos-unstable
# Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches # Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches
extra_nix_config: | extra_nix_config: |
experimental-features = nix-command flakes experimental-features = nix-command flakes
extra-substituters = https://nix-community.cachix.org extra-substituters = https://nix-community.cachix.org
extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
extra-substituters = https://crane.cachix.org extra-substituters = https://crane.cachix.org
extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk= extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=
extra-substituters = https://nix.computer.surgery/conduit extra-substituters = https://nix.computer.surgery/conduit
extra-trusted-public-keys = conduit:ZGAf6P6LhNvnoJJ3Me3PRg7tlLSrPxcQ2RiE5LIppjo= extra-trusted-public-keys = conduit:ZGAf6P6LhNvnoJJ3Me3PRg7tlLSrPxcQ2RiE5LIppjo=
extra-substituters = https://attic.kennel.juneis.dog/conduit extra-substituters = https://attic.kennel.juneis.dog/conduit
extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg= extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
extra-substituters = https://attic.kennel.juneis.dog/conduwuit extra-substituters = https://attic.kennel.juneis.dog/conduwuit
extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw= extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
- name: Add alternative Nix binary caches if specified - name: Add alternative Nix binary caches if specified
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }} if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
run: | run: |
echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf
echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf
- name: Pop/push Magic Nix Cache - name: Pop/push Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main uses: DeterminateSystems/magic-nix-cache-action@main
- name: Configure `nix-direnv` - name: Configure `nix-direnv`
run: | run: |
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc" echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
- name: Install `direnv` and `nix-direnv` - name: Install `direnv` and `nix-direnv`
run: nix-env -f "<nixpkgs>" -iA direnv -iA nix-direnv run: nix-env -f "<nixpkgs>" -iA direnv -iA nix-direnv
- name: Pop/push downloaded crate cache - name: Pop/push downloaded crate cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
key: downloaded-crates key: downloaded-crates
path: ~/.cargo path: ~/.cargo
- name: Pop/push compiled crate cache - name: Pop/push compiled crate cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
key: compiled-crates-${{runner.os}} key: compiled-crates-${{runner.os}}
path: target path: target
# Do this to shorten the logs for the real CI step # Do this to shorten the logs for the real CI step
- name: Populate `/nix/store` - name: Populate `/nix/store`
run: nix develop --command true run: nix develop --command true
- name: Allow direnv - name: Allow direnv
run: direnv allow run: direnv allow
- name: Cache x86_64 inputs for devShell - name: Cache x86_64 inputs for devShell
run: | run: |
./bin/nix-build-and-cache .#devShells.x86_64-linux.default.inputDerivation ./bin/nix-build-and-cache .#devShells.x86_64-linux.default.inputDerivation
- name: Perform continuous integration
run: direnv exec . engage
- name: Perform continuous integration build-static:
run: direnv exec . engage name: Static Artifacts
runs-on: ubuntu-latest
needs: tests
strategy:
max-parallel: 8
matrix:
target:
[
"x86_64-unknown-linux-musl",
"x86_64-unknown-linux-musl-jemalloc",
"aarch64-unknown-linux-musl",
"aarch64-unknown-linux-musl-jemalloc",
]
steps:
- name: Sync repository
uses: actions/checkout@v4
- name: Install Nix (with flakes and nix-command enabled)
uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
build-static: # Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches
name: Static Artifacts extra_nix_config: |
runs-on: ubuntu-latest experimental-features = nix-command flakes
needs: tests extra-substituters = https://nix-community.cachix.org
strategy: extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
max-parallel: 3 extra-substituters = https://crane.cachix.org
matrix: extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=
target: [ extra-substituters = https://nix.computer.surgery/conduit
"x86_64-unknown-linux-musl", extra-trusted-public-keys = conduit:ZGAf6P6LhNvnoJJ3Me3PRg7tlLSrPxcQ2RiE5LIppjo=
"x86_64-unknown-linux-musl-jemalloc", extra-substituters = https://attic.kennel.juneis.dog/conduit
"aarch64-unknown-linux-musl", extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
"aarch64-unknown-linux-musl-jemalloc", extra-substituters = https://attic.kennel.juneis.dog/conduwuit
] extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
steps: - name: Add alternative Nix binary caches if specified
- name: Sync repository if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
uses: actions/checkout@v4 run: |
echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf
echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf
- name: Install Nix (with flakes and nix-command enabled) - name: Pop/push Magic Nix Cache
uses: cachix/install-nix-action@v26 uses: DeterminateSystems/magic-nix-cache-action@main
with:
nix_path: nixpkgs=channel:nixos-unstable
# Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches - name: Configure `nix-direnv`
extra_nix_config: | run: |
experimental-features = nix-command flakes echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
extra-substituters = https://nix-community.cachix.org
extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
extra-substituters = https://crane.cachix.org
extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=
extra-substituters = https://nix.computer.surgery/conduit
extra-trusted-public-keys = conduit:ZGAf6P6LhNvnoJJ3Me3PRg7tlLSrPxcQ2RiE5LIppjo=
extra-substituters = https://attic.kennel.juneis.dog/conduit
extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
extra-substituters = https://attic.kennel.juneis.dog/conduwuit
extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
- name: Add alternative Nix binary caches if specified - name: Install `direnv` and `nix-direnv`
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }} run: nix-env -f "<nixpkgs>" -iA direnv -iA nix-direnv
run: |
echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf
echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf
- name: Pop/push Magic Nix Cache - name: Pop/push downloaded crate cache
uses: DeterminateSystems/magic-nix-cache-action@main uses: actions/cache@v4
with:
key: downloaded-crates
path: ~/.cargo
- name: Configure `nix-direnv` - name: Pop/push compiled crate cache
run: | uses: actions/cache@v4
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc" with:
key: compiled-crates-${{runner.os}}
path: target
- name: Install `direnv` and `nix-direnv` # Do this to shorten the logs for the real CI step
run: nix-env -f "<nixpkgs>" -iA direnv -iA nix-direnv - name: Populate `/nix/store`
run: nix develop --command true
- name: Pop/push downloaded crate cache - name: Allow direnv
uses: actions/cache@v4 run: direnv allow
with:
key: downloaded-crates
path: ~/.cargo
- name: Pop/push compiled crate cache - name: Cache x86_64 inputs for devShell
uses: actions/cache@v4 run: |
with: ./bin/nix-build-and-cache .#devShells.x86_64-linux.default.inputDerivation
key: compiled-crates-${{runner.os}}
path: target
# Do this to shorten the logs for the real CI step - name: Build static artifacts
- name: Populate `/nix/store` run: |
run: nix develop --command true ./bin/nix-build-and-cache .#static-${{ matrix.target }}
mkdir -p target/release
cp -v -f result/bin/conduit target/release
direnv exec . cargo deb --no-build --no-strip --output target/debian/${{ matrix.target }}.deb
- name: Allow direnv - name: Upload static artifacts
run: direnv allow uses: actions/upload-artifact@v4
with:
name: static-${{ matrix.target }}
path: result/bin/conduit
if-no-files-found: error
- name: Cache x86_64 inputs for devShell - name: Upload static deb artifacts
run: | uses: actions/upload-artifact@v4
./bin/nix-build-and-cache .#devShells.x86_64-linux.default.inputDerivation with:
name: ${{ matrix.target }}.deb
path: target/debian/${{ matrix.target }}.deb
if-no-files-found: error
build-oci:
name: OCI Artifacts and Publish
runs-on: ubuntu-latest
needs: tests
strategy:
max-parallel: 8
matrix:
oci-target:
[
"x86_64-unknown-linux-musl",
"x86_64-unknown-linux-musl-jemalloc",
"aarch64-unknown-linux-musl",
"aarch64-unknown-linux-musl-jemalloc",
]
- name: Build static artifacts steps:
run: | - name: Sync repository
./bin/nix-build-and-cache .#static-${{ matrix.target }} uses: actions/checkout@v4
mkdir -p target/release
cp -v -f result/bin/conduit target/release
direnv exec . cargo deb --no-build --no-strip --output target/debian/${{ matrix.target }}.deb
- name: Upload static artifacts - name: Install Nix (with flakes and nix-command enabled)
uses: actions/upload-artifact@v4 uses: cachix/install-nix-action@v26
with: with:
name: static-${{ matrix.target }} nix_path: nixpkgs=channel:nixos-unstable
path: result/bin/conduit
if-no-files-found: error
- name: Upload static deb artifacts # Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches
uses: actions/upload-artifact@v4 extra_nix_config: |
with: experimental-features = nix-command flakes
name: ${{ matrix.target }}.deb extra-substituters = https://nix-community.cachix.org
path: target/debian/${{ matrix.target }}.deb extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
if-no-files-found: error extra-substituters = https://crane.cachix.org
extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=
extra-substituters = https://nix.computer.surgery/conduit
extra-trusted-public-keys = conduit:ZGAf6P6LhNvnoJJ3Me3PRg7tlLSrPxcQ2RiE5LIppjo=
extra-substituters = https://attic.kennel.juneis.dog/conduit
extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
extra-substituters = https://attic.kennel.juneis.dog/conduwuit
extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
- name: Add alternative Nix binary caches if specified
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
run: |
echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf
echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf
- name: Pop/push Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
build-oci: - name: Configure `nix-direnv`
name: OCI Artifacts and Publish run: |
runs-on: ubuntu-latest echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
needs: tests
strategy:
max-parallel: 3
matrix:
oci-target: [
#"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-unknown-linux-musl-jemalloc",
"aarch64-unknown-linux-musl",
"aarch64-unknown-linux-musl-jemalloc",
]
steps: - name: Install `direnv` and `nix-direnv`
- name: Sync repository run: nix-env -f "<nixpkgs>" -iA direnv -iA nix-direnv
uses: actions/checkout@v4
- name: Install Nix (with flakes and nix-command enabled) - name: Pop/push downloaded crate cache
uses: cachix/install-nix-action@v26 uses: actions/cache@v4
with: with:
nix_path: nixpkgs=channel:nixos-unstable key: downloaded-crates
path: ~/.cargo
# Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches - name: Pop/push compiled crate cache
extra_nix_config: | uses: actions/cache@v4
experimental-features = nix-command flakes with:
extra-substituters = https://nix-community.cachix.org key: compiled-crates-${{runner.os}}
extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= path: target
extra-substituters = https://crane.cachix.org
extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=
extra-substituters = https://nix.computer.surgery/conduit
extra-trusted-public-keys = conduit:ZGAf6P6LhNvnoJJ3Me3PRg7tlLSrPxcQ2RiE5LIppjo=
extra-substituters = https://attic.kennel.juneis.dog/conduit
extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
extra-substituters = https://attic.kennel.juneis.dog/conduwuit
extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
- name: Add alternative Nix binary caches if specified # Do this to shorten the logs for the real CI step
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }} - name: Populate `/nix/store`
run: | run: nix develop --command true
echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf
echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf
- name: Pop/push Magic Nix Cache - name: Allow direnv
uses: DeterminateSystems/magic-nix-cache-action@main run: direnv allow
- name: Configure `nix-direnv` - name: Cache x86_64 inputs for devShell
run: | run: |
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc" ./bin/nix-build-and-cache .#devShells.x86_64-linux.default.inputDerivation
- name: Install `direnv` and `nix-direnv` - name: Build OCI images
run: nix-env -f "<nixpkgs>" -iA direnv -iA nix-direnv run: |
./bin/nix-build-and-cache .#oci-image-${{ matrix.oci-target }}
cp -v -f result oci-image-${{ matrix.oci-target }}.tar.gz
- name: Pop/push downloaded crate cache - name: Upload OCI image artifacts
uses: actions/cache@v4 uses: actions/upload-artifact@v4
with: with:
key: downloaded-crates name: oci-image-${{ matrix.oci-target }}
path: ~/.cargo path: oci-image-${{ matrix.oci-target }}.tar.gz
if-no-files-found: error
# don't compress again
compression-level: 0
- name: Pop/push compiled crate cache create-and-push-manifest:
uses: actions/cache@v4 name: Create and Push Docker Manifest
with: runs-on: ubuntu-latest
key: compiled-crates-${{runner.os}} needs: build-oci
path: target if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
steps:
- name: Download OCI Images Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
# Do this to shorten the logs for the real CI step - name: Load OCI Images and tag
- name: Populate `/nix/store` run: |
run: nix develop --command true ID_AARCH64=$(docker load -i oci-image-aarch64-unknown-linux-musl-jemalloc.tar.gz | sed -n 's/Loaded image: \(.*\)/\1/p')
docker tag $ID_AARCH64 conduwuit:${{ github.sha }}-aarch64-jemalloc
ID_X86_64=$(docker load -i oci-image-x86_64-unknown-linux-musl-jemalloc.tar.gz | sed -n 's/Loaded image: \(.*\)/\1/p')
docker tag $ID_X86_64 conduwuit:${{ github.sha }}-x86_64-jemalloc
- name: Allow direnv - name: Login to GitHub Container Registry
run: direnv allow uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache x86_64 inputs for devShell - name: Create and push Manifest to GitHub
run: | run: |
./bin/nix-build-and-cache .#devShells.x86_64-linux.default.inputDerivation REPO_GHCR="ghcr.io/${{ github.repository }}"
SHA_TAG="${{ github.ref_name }}-${{ github.sha }}"
BRANCH_TAG="${{ github.ref_name }}"
if [ "$BRANCH_TAG" == "main" ]; then
BRANCH_TAG="latest"
fi
docker manifest create $REPO_GHCR:$SHA_TAG \
--amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
--amend conduwuit:${{ github.sha }}-aarch64-jemalloc
docker manifest push $REPO_GHCR:$SHA_TAG
- name: Build OCI images docker manifest create $REPO_GHCR:$BRANCH_TAG \
run: | --amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
./bin/nix-build-and-cache .#oci-image-${{ matrix.oci-target }} --amend conduwuit:${{ github.sha }}-aarch64-jemalloc
cp -v -f result oci-image-${{ matrix.oci-target }}.tar.gz docker manifest push $REPO_GHCR:$BRANCH_TAG
- name: Upload OCI image artifacts - name: Login to Docker Hub
uses: actions/upload-artifact@v4 uses: docker/login-action@v3
with: with:
name: oci-image-${{ matrix.oci-target }} username: ${{ secrets.DOCKER_USERNAME }}
path: oci-image-${{ matrix.oci-target }}.tar.gz password: ${{ secrets.DOCKERHUB_TOKEN }}
if-no-files-found: error
# don't compress again
compression-level: 0
create-and-push-manifest: - name: Create and push manifest to Docker Hub
name: Create and Push Docker Manifest run: |
runs-on: ubuntu-latest REPO_DOCKER="docker.io/${{ github.repository }}"
needs: build-oci SHA_TAG="${{ github.ref_name }}-${{ github.sha }}"
BRANCH_TAG="${{ github.ref_name }}"
if [ "$BRANCH_TAG" == "main" ]; then
BRANCH_TAG="latest"
fi
steps: docker manifest create $REPO_DOCKER:$SHA_TAG \
- name: Extract and load OCI Images --amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
run: | --amend conduwuit:${{ github.sha }}-aarch64-jemalloc
unzip oci-image-x86_64-unknown-linux-musl-jemalloc.zip docker manifest push $REPO_DOCKER:$SHA_TAG
docker load -i oci-image-x86_64-unknown-linux-musl-jemalloc.tar.gz
unzip oci-image-aarch64-unknown-linux-musl-jemalloc.zip
docker load -i oci-image-aarch64-unknown-linux-musl-jemalloc.tar.gz
- name: Login to Docker Hub docker manifest create $REPO_DOCKER:$BRANCH_TAG \
uses: docker/login-action@v3 --amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
env: --amend conduwuit:${{ github.sha }}-aarch64-jemalloc
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} docker manifest push $REPO_DOCKER:$BRANCH_TAG
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
if: ${{ (github.event_name != 'pull_request') && (env.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
with:
# username is not really a secret
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and Push Manifest to Docker Hub
run: |
DOCKER_IMAGE_NAME="docker.io/${{ github.repository }}"
BRANCH_NAME="${{ github.ref_name }}"
SHA_TAG="${BRANCH_NAME}-${{ github.sha }}"
BRANCH_TAG=$BRANCH_NAME
if [ "$BRANCH_NAME" == "main" ]; then
BRANCH_TAG="latest"
fi
# Create and push SHA specific manifest
docker manifest create $DOCKER_IMAGE_NAME:$SHA_TAG \
--amend $DOCKER_IMAGE_NAME:${{ github.sha }}-x86_64-jemalloc \
--amend $DOCKER_IMAGE_NAME:${{ github.sha }}-aarch64-jemalloc
docker manifest push $DOCKER_IMAGE_NAME:$SHA_TAG
# Update and push branch or latest manifest
docker manifest create $DOCKER_IMAGE_NAME:$BRANCH_TAG \
--amend $DOCKER_IMAGE_NAME:${{ github.sha }}-x86_64-jemalloc \
--amend $DOCKER_IMAGE_NAME:${{ github.sha }}-aarch64-jemalloc
docker manifest push $DOCKER_IMAGE_NAME:$BRANCH_TAG
- name: Create and Push Manifest to GitHub Container Registry
run: |
GHCR_IMAGE_NAME="ghcr.io/${{ github.repository }}"
BRANCH_NAME="${{ github.ref_name }}"
SHA_TAG="${BRANCH_NAME}-${{ github.sha }}"
BRANCH_TAG=$BRANCH_NAME
if [ "$BRANCH_NAME" == "main" ]; then
BRANCH_TAG="latest"
fi
# Create and push SHA specific manifest
docker manifest create $GHCR_IMAGE_NAME:$SHA_TAG \
--amend $GHCR_IMAGE_NAME:${{ github.sha }}-x86_64-jemalloc \
--amend $GHCR_IMAGE_NAME:${{ github.sha }}-aarch64-jemalloc
docker manifest push $GHCR_IMAGE_NAME:$SHA_TAG
# Update and push branch or latest manifest
docker manifest create $GHCR_IMAGE_NAME:$BRANCH_TAG \
--amend $GHCR_IMAGE_NAME:${{ github.sha }}-x86_64-jemalloc \
--amend $GHCR_IMAGE_NAME:${{ github.sha }}-aarch64-jemalloc
docker manifest push $GHCR_IMAGE_NAME:$BRANCH_TAG