Skip to content

Repository refactoring #2

Repository refactoring

Repository refactoring #2

Workflow file for this run

---
name: "🏗 Next"
on:
push:
branches:
- master
tags:
- '*.*'
pull_request:
jobs:
# ------------------------
# Step 1: define the matrix
# ------------------------
distro_matrix:
runs-on: ubuntu-latest
outputs:
distros: ${{ steps.set_matrix.outputs.distros }}
steps:
- name: Set matrix of distros
id: set_matrix
run: |
echo 'distros=["debian","fedora","tumbleweed","alpine"]' >> $GITHUB_OUTPUT
# ------------------------
# Step 2: Build staging images
# ------------------------
build_staging:
runs-on: ubuntu-latest
needs:
- distro_matrix
strategy:
matrix:
distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }}
name: Build staging container
steps:
- name: Check out repo
uses: actions/checkout@v6
- name: Get release version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.12.0
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build staging image
uses: docker/build-push-action@v6.19.2
with:
file: staging/Dockerfile.${{ matrix.distro }}
platforms: linux/amd64
push: true
provenance: false
tags: |
ghcr.io/linux-nvme/${{ matrix.distro }}.staging:next
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}.staging:main', matrix.distro) || '' }}
# ------------------------
# Step 3: Build tools using staging containers
# ------------------------
build_tools:
runs-on: ubuntu-latest
needs:
- distro_matrix
- build_staging
strategy:
matrix:
distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }}
name: Build samurai and muon
container:
image: ghcr.io/linux-nvme/${{ matrix.distro }}.staging:next
steps:
- name: Check out repo
uses: actions/checkout@v6
- name: Build tools
run: scripts/build-muon.sh
- uses: actions/upload-artifact@v7
with:
name: samu-muon-${{ matrix.distro }}
path: bin
# ------------------------
# Step 4: Deploy final containers
# ------------------------
deploy_containers:
runs-on: ubuntu-latest
needs:
- distro_matrix
- build_tools
strategy:
matrix:
distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }}
name: Deploy final containers
steps:
- name: Check out repo
uses: actions/checkout@v6
- name: Get release version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=" >> $GITHUB_ENV
fi
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: samu-muon-${{ matrix.distro }}
path: bin
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.12.0
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build final image
uses: docker/build-push-action@v6.19.2
with:
context: .
file: main/Dockerfile.${{ matrix.distro }}
platforms: linux/amd64
push: true
provenance: false
tags: |
ghcr.io/linux-nvme/${{ matrix.distro }}:next
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}:{1}', matrix.distro, env.RELEASE_VERSION) || '' }}
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}:latest', matrix.distro) || '' }}
deploy_cross_containers:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- armhf
- ppc64le
- s390x
name: ubuntu cross container
steps:
- name: Check out repo
uses: actions/checkout@v6
- name: Get release version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.12.0
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v6.19.2
with:
file: main/Dockerfile.ubuntu.${{ matrix.arch }}
platforms: linux/amd64
push: true
provenance: false
tags: |
ghcr.io/linux-nvme/ubuntu-cross-${{ matrix.arch }}:next
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/ubuntu-cross-{0}:{1}', matrix.arch, env.RELEASE_VERSION) || '' }}
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/ubuntu-cross-{0}:latest', matrix.arch) || '' }}