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: Docker Image Builder | |
| on: | |
| push: | |
| # workflow_dispatch: | |
| # schedule: | |
| # # Run once a week on Fridays | |
| # - cron: "0 0 * * FRI" | |
| # pull_request: | |
| # paths: | |
| # - '.github/workflows/docker-images.yml' | |
| # push: | |
| # branches: | |
| # - main | |
| # paths: | |
| # - '.github/workflows/docker-images.yml' | |
| #jobs: | |
| # buildx: | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Set up QEMU | |
| # uses: docker/setup-qemu-action@v3 | |
| # - name: Set up Docker Buildx | |
| # uses: docker/setup-buildx-action@v3 | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.IMAGE.RUNNER }} | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| IMAGE: | |
| - { | |
| TAG_NAME: "archlinux:latest", | |
| DOCKER_PLATFORM: "linux/loong64", | |
| DOCKERFILE_PATH: ".github/workflows", | |
| RUNNER: "ubuntu-latest", | |
| } | |
| name: Build Archlinux docker image | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| persist-credentials: false | |
| - name: Pull existing image | |
| run: docker pull ghcr.io/${{ github.repository_owner }}/${{ matrix.IMAGE.TAG_NAME }} || true | |
| if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' | |
| - name: Setup environment variables | |
| shell: bash | |
| id: image-name | |
| run: | | |
| IMAGE_NAME=$(echo "${{ matrix.IMAGE.TAG_NAME }}" | cut -d ':' -f 1) | |
| echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 | |
| with: | |
| cache-binary: false | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/docker' | |
| - name: Build docker image | |
| uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 # v6.17.0 | |
| id: docker-build | |
| with: | |
| context: ${{ matrix.IMAGE.DOCKERFILE_PATH }} | |
| cache-from: ghcr.io/${{ github.repository_owner }}/${{ matrix.IMAGE.TAG_NAME }} | |
| tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.IMAGE.TAG_NAME }} | |
| platforms: ${{ matrix.IMAGE.DOCKER_PLATFORM }} | |
| pull: true | |
| push: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/docker' }} | |
| - name: Attese | |
| uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0 | |
| with: | |
| subject-name: "ghcr.io/${{ github.repository_owner }}/${{ matrix.IMAGE.TAG_NAME }}" | |
| subject-digest: ${{ steps.docker-build.outputs.digest }} | |
| push-to-registry: true | |
| if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/docker' |