Skip to content

Commit

Permalink
feat: add CI for forge branch
Browse files Browse the repository at this point in the history
Signed-off-by: 陳鈞 <jim60105@gmail.com>
  • Loading branch information
jim60105 committed Mar 12, 2024
1 parent 073759f commit 12a3ec5
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 11 deletions.
95 changes: 84 additions & 11 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ on:
workflow_dispatch:

jobs:
docker:
docker-tag:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout
Expand All @@ -24,15 +25,8 @@ jobs:
- name: Checkout submodule
run: |
cd stable-diffusion-webui && \
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
git fetch --all --tags && \
git checkout tags/${{ github.ref_name }} -b ${{ github.ref_name }}
echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
else
git fetch origin +refs/heads/*:refs/remotes/origin/* -v && \
git checkout -b dev origin/dev;
echo "VERSION=dev" >> "$GITHUB_ENV";
fi
git fetch --all --tags && \
git checkout tags/${{ github.ref_name }} -b ${{ github.ref_name }}
- name: Setup docker
id: setup
Expand All @@ -51,7 +45,86 @@ jobs:
tags: ${{ steps.setup.outputs.tags }}
labels: ${{ steps.setup.outputs.labels }}
build-args: |
VERSION=${{ env.VERSION }}
VERSION=${{ github.ref_name }}
RELEASE=${{ github.run_number }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max

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: Setup docker
id: setup
uses: ./.github/workflows/docker-reused-setup-steps
with:
CR_PAT: ${{ secrets.CR_PAT }}
tag: ${{ github.head_ref || github.ref_name }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
target: final
tags: ${{ steps.setup.outputs.tags }}
labels: ${{ steps.setup.outputs.labels }}
build-args: |
VERSION=dev
RELEASE=${{ github.run_number }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max

docker-forge:
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 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: Setup docker
id: setup
uses: ./.github/workflows/docker-reused-setup-steps
with:
CR_PAT: ${{ secrets.CR_PAT }}
tag: ${{ github.head_ref || github.ref_name }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
target: final
tags: ${{ steps.setup.outputs.tags }}
labels: ${{ steps.setup.outputs.labels }}
build-args: |
VERSION=forge
RELEASE=${{ github.run_number }}
platforms: linux/amd64
cache-from: type=gha
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: "3.9"
services:
stable-diffusion-webui:
container_name: stable-diffusion-webui
# image: ghcr.io/jim60105/stable-diffusion-webui:forge
image: ghcr.io/jim60105/stable-diffusion-webui:v1.8.0
# build: .
user: "1001:0"
Expand Down

0 comments on commit 12a3ec5

Please sign in to comment.