fix: set STABLE_DIFFUSION_REPO to working fork, update image tag #51
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 and Push Docker Image | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| paths-ignore: | |
| - 'k8s/**' | |
| - '*.md' | |
| - 'docs/**' | |
| pull_request: | |
| branches: [ main ] | |
| paths-ignore: | |
| - 'k8s/**' | |
| - '*.md' | |
| - 'docs/**' | |
| workflow_dispatch: | |
| env: | |
| INTERNAL_REGISTRY: harbor-core.harbor.svc.cluster.local | |
| PROJECT: stable-diffusion | |
| IMAGE_NAME: stable-diffution-webui-rcom | |
| jobs: | |
| build: | |
| runs-on: stable-diffution-webui-rcom-runner | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Fetch secrets from Infisical | |
| uses: Infisical/secrets-action@v1.0.7 | |
| with: | |
| client-id: ${{ secrets.INFISICAL_CLIENT_ID }} | |
| client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }} | |
| env-slug: prod | |
| project-slug: homelab-bz-gt | |
| secret-path: / | |
| export-type: env | |
| domain: http://infisical-infisical-standalone-infisical.infisical.svc.cluster.local:8080 | |
| - name: Log in to Harbor (internal) | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.INTERNAL_REGISTRY }} | |
| username: ${{ env.HB_USERNAME }} | |
| password: ${{ env.HB_PASSWORD }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| buildkitd-config-inline: | | |
| [registry."harbor-core.harbor.svc.cluster.local"] | |
| ca=["/etc/ssl/certs/ca-certificates.crt"] | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.INTERNAL_REGISTRY }}/${{ env.PROJECT }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }} | |
| type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }} | |
| type=ref,event=pr | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| STABLE_DIFFUSION_TAG=v1.10.1 | |
| cache-from: type=registry,ref=${{ env.INTERNAL_REGISTRY }}/${{ env.PROJECT }}/${{ env.IMAGE_NAME }}:buildcache | |
| cache-to: type=registry,ref=${{ env.INTERNAL_REGISTRY }}/${{ env.PROJECT }}/${{ env.IMAGE_NAME }}:buildcache,mode=max | |
| - name: Create GitHub release | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| LATEST_TAG=$(curl -sf -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| "https://api.github.com/repos/${REPO}/releases/latest" \ | |
| | jq -r '.tag_name // "v0.0.0"') | |
| VERSION=${LATEST_TAG#v} | |
| MAJOR=$(echo $VERSION | cut -d. -f1) | |
| MINOR=$(echo $VERSION | cut -d. -f2) | |
| PATCH=$(echo $VERSION | cut -d. -f3) | |
| NEW_TAG="v${MAJOR}.${MINOR}.$((PATCH + 1))" | |
| curl -sf -X POST \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| "https://api.github.com/repos/${REPO}/releases" \ | |
| -d "$(jq -n --arg tag "$NEW_TAG" --arg name "$NEW_TAG" \ | |
| '{tag_name: $tag, name: $name, generate_release_notes: true}')" |