Build Latest Image #7401
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
| # SPDX-FileCopyrightText: 2025 Joe Pitt | |
| # | |
| # SPDX-License-Identifier: GPL-3.0-only | |
| name: Build Latest Image | |
| on: | |
| schedule: | |
| - cron: 35 * * * * | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| dependencies: | |
| name: Get Dependency Information | |
| runs-on: ubuntu-latest | |
| outputs: | |
| python_digest: ${{ steps.digest.outputs.digest }} | |
| a1111_version: ${{ steps.a1111.outputs.tag }} | |
| major_tag: ${{ steps.image_tags.outputs.major_tag }} | |
| minor_tag: ${{ steps.image_tags.outputs.minor_tag }} | |
| patch_tag: ${{ steps.image_tags.outputs.patch_tag }} | |
| steps: | |
| - name: Get Current Digest for Python 3.10 image | |
| id: digest | |
| uses: joepitt91/action-digest-from-dockerhub-image@v1 | |
| with: | |
| dockerhub_username: ${{ secrets.DOCKER_USER }} | |
| dockerhub_token: ${{ secrets.DOCKER_PASSWORD }} | |
| repository: python | |
| tag: 3.10-slim | |
| - name: Get Latest AUTOMATIC1111 Version | |
| id: a1111 | |
| uses: joepitt91/action-version-from-github-tag@v2 | |
| with: | |
| token: ${{ secrets.PUBLIC_READ_TOKEN }} | |
| owner: AUTOMATIC1111 | |
| repository: stable-diffusion-webui | |
| - name: Convert Version to Tags | |
| id: image_tags | |
| uses: joepitt91/action-version-to-tags@v1 | |
| with: | |
| version: ${{ steps.a1111.outputs.version }} | |
| build: | |
| name: Build Image | |
| if: needs.dependencies.outputs.python_digest != vars.BASE_IMAGE || needs.dependencies.outputs.a1111_version != vars.A1111_VERSION || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| needs: | |
| - dependencies | |
| steps: | |
| - name: Free Up Disk Space | |
| uses: jlumbroso/free-disk-space@main | |
| - name: Image Information | |
| run: echo "Building image of AUTOMATIC1111 ${{ needs.dependencies.outputs.a1111_version }} from python:3.10-slim with digest ${{ needs.dependencies.outputs.python_digest }}" | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build and Push Image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| build-args: | | |
| A1111_VERSION=${{ needs.dependencies.outputs.a1111_version }} | |
| provenance: true | |
| pull: true | |
| push: true | |
| sbom: true | |
| tags: | | |
| ghcr.io/joepitt91/automatic1111:latest | |
| ghcr.io/joepitt91/automatic1111:${{ needs.dependencies.outputs.major_tag }} | |
| ghcr.io/joepitt91/automatic1111:${{ needs.dependencies.outputs.minor_tag }} | |
| ghcr.io/joepitt91/automatic1111:${{ needs.dependencies.outputs.patch_tag }} | |
| save_versions: | |
| name: Save Versions | |
| needs: | |
| - build | |
| - dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Update BASE_IMAGE | |
| uses: mmoyaferrer/set-github-variable@v1.0.0 | |
| with: | |
| name: BASE_IMAGE | |
| repository: ${{ github.repository }} | |
| token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
| value: ${{ needs.dependencies.outputs.python_digest }} | |
| - name: Update A1111_VERSION | |
| uses: mmoyaferrer/set-github-variable@v1.0.0 | |
| with: | |
| name: A1111_VERSION | |
| repository: ${{ github.repository }} | |
| token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
| value: ${{ needs.dependencies.outputs.a1111_version }} |