| | |
| |
|
| | name: Create Docker Image (Release and Staging) |
| |
|
| | on: |
| | release: |
| | |
| | types: [published] |
| | schedule: |
| | |
| | - cron: "0 0 * * *" |
| | push: |
| | |
| | branches: |
| | - release |
| |
|
| | env: |
| | |
| | REPO: ${{ github.repository }} |
| | REGISTRY: ghcr.io |
| |
|
| | jobs: |
| | build: |
| | if: github.repository == 'SillyTavern/SillyTavern' |
| | runs-on: ubuntu-latest |
| |
|
| | steps: |
| | |
| | - name: Set lowercase repo name |
| | run: | |
| | echo "IMAGE_NAME=${REPO,,}" >> ${GITHUB_ENV} |
| | |
| | |
| | |
| | |
| | - name: Checkout the release branch (on release) |
| | if: ${{ github.event_name == 'release' || github.event_name == 'push' }} |
| | uses: actions/checkout@v4.1.2 |
| | with: |
| | ref: "release" |
| |
|
| | - name: Checkout the staging branch |
| | if: ${{ github.event_name == 'schedule' }} |
| | uses: actions/checkout@v4.1.2 |
| | with: |
| | ref: "staging" |
| |
|
| | |
| | |
| | |
| | |
| | - name: Get the current branch name |
| | run: | |
| | echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> ${GITHUB_ENV} |
| | |
| | |
| | - name: Set up QEMU |
| | uses: docker/setup-qemu-action@v3 |
| |
|
| | - name: Set up Docker Buildx |
| | uses: docker/setup-buildx-action@v3 |
| |
|
| | - name: Extract metadata (tags, labels) for the image |
| | uses: docker/metadata-action@v5.5.1 |
| | id: metadata |
| | with: |
| | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| | |
| | |
| | |
| | tags: | |
| | ${{ github.event_name == 'release' && github.ref_name || env.BRANCH_NAME }} |
| | ${{ github.event_name == 'push' && env.BRANCH_NAME == 'release' && 'latest' || '' }} |
| | |
| | |
| | - name: Log in to the Container registry |
| | uses: docker/login-action@v3 |
| | with: |
| | registry: ${{ env.REGISTRY }} |
| | username: ${{ github.actor }} |
| | password: ${{ secrets.GITHUB_TOKEN }} |
| |
|
| | |
| | |
| | |
| | - name: Build and push |
| | uses: docker/build-push-action@v5.3.0 |
| | with: |
| | context: . |
| | platforms: linux/amd64,linux/arm64 |
| | file: Dockerfile |
| | push: true |
| | tags: ${{ steps.metadata.outputs.tags }} |
| | labels: ${{ steps.metadata.outputs.labels }} |
| |
|