Skip to content

docker_publish

docker_publish #187

# Check this guide for more information about publishing to ghcr.io with GitHub Actions:
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
# Build the Docker image and push it to the registry
name: docker_publish
on:
# Trigger the workflow on tags push that match the pattern v*, for example v1.0.0
push:
tags:
- "v*"
schedule:
- cron: "0 7 * * 0" # 7:00 AM every Sunday
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets the permissions granted to the GITHUB_TOKEN for the actions in this job.
permissions:
contents: read
packages: write
jobs:
docker-tag:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout submodule
run: |
cd stable-diffusion-webui && \
git fetch --all --tags && \
git checkout tags/${{ github.ref_name }} -b ${{ github.ref_name }}
- name: Build docker
uses: ./.github/workflows/docker-reused-steps
with:
tag: ${{ github.ref_name }}
docker-dev:
runs-on: ubuntu-latest
if: (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'))
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout submodule
run: |
cd stable-diffusion-webui && \
git fetch origin +refs/heads/*:refs/remotes/origin/* -v && \
git checkout -b dev origin/dev;
- name: Build docker
uses: ./.github/workflows/docker-reused-steps
with:
tag: dev
docker-forge:
runs-on: ubuntu-latest
if: (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'))
# Runs one by one to reuse the docker layer cache
needs: docker-dev
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout submodule
run: |
cd stable-diffusion-webui && \
git remote add forge https://github.com/lllyasviel/stable-diffusion-webui-forge && \
git fetch forge +refs/heads/*:refs/remotes/forge/* -v && \
git checkout -b main forge/main;
- name: Build docker
uses: ./.github/workflows/docker-reused-steps
with:
tag: forge