Repository navigation
Build Stub #5
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: Build Stub | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.*" | |
| workflow_dispatch: | |
| inputs: | |
| latest: | |
| description: "Tag the image as latest" | |
| required: false | |
| type: boolean | |
| default: true | |
| tag: | |
| description: "Tag to build (defaults to current commit)" | |
| required: false | |
| type: string | |
| env: | |
| REGISTRY: ghcr.io/muak-os | |
| jobs: | |
| build: | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [amd64, arm64] | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-latest | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: docker/setup-buildx-action@v4 | |
| id: buildx | |
| - uses: taiki-e/install-action@just | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Determine tag | |
| id: tag | |
| run: | | |
| if [[ -n "${{ inputs.tag }}" ]]; then | |
| echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tag=$(git describe --tag --always --dirty --match v[0-9]* 2>/dev/null || echo dev)" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build stub (${{ matrix.arch }}) | |
| run: | | |
| CONTAINER_RUNTIME=docker \ | |
| ARCH=${{ matrix.arch }} \ | |
| PUSH=true \ | |
| TAG=ci \ | |
| just oci | |
| manifest: | |
| name: Combine multi-arch manifest | |
| needs: build | |
| permissions: | |
| contents: read | |
| packages: write | |
| runs-on: ubuntu-latest | |
| env: | |
| REGISTRY: ghcr.io/muak-os | |
| CONTAINER_RUNTIME: docker | |
| TOOLS: ghcr.io/muak-os/tools:latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: taiki-e/install-action@just | |
| - name: Determine tag | |
| id: tag | |
| run: | | |
| if [[ -n "${{ inputs.tag }}" ]]; then | |
| echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tag=$(git describe --tag --always --dirty --match v[0-9]* 2>/dev/null || echo dev)" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create multi-arch manifest (${{ steps.tag.outputs.tag }}) | |
| env: | |
| TAG: ${{ steps.tag.outputs.tag }} | |
| LATEST: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.latest) }} | |
| KOCI_REGISTRY_USERNAME: ${{ github.actor }} | |
| KOCI_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| just merge amd64=ci-amd64 arm64=ci-arm64 | |
| - name: Build summary | |
| run: | | |
| echo "### Multi-arch manifest created" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **Tag:** \`${REGISTRY}/stub:${{ steps.tag.outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY" | |
| if [[ "${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.latest) }}" == "true" ]]; then | |
| echo "- **Latest:** \`${REGISTRY}/stub:latest\`" >> "$GITHUB_STEP_SUMMARY" | |
| fi |