name: Create and publish a Docker image to GitHub Container Registry on: push: branches: ['main'] env: REGISTRY: ghcr.io OWNER: xeserv IMAGE_NAME: ${{ github.repository }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_ENDPOINT_URL_S3: https://fly.storage.tigris.dev AWS_ENDPOINT_URL_IAM: https://fly.iam.storage.tigris.dev AWS_REGION: auto jobs: build-and-push-image: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@v3 - name: Log in to the Container registry uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} username: ${{ env.OWNER }} password: ${{ secrets.GITHUB_TOKEN }} - id: install-aws-cli uses: unfor19/install-aws-cli-action@v1 with: arch: amd64 - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - run: | aws s3 sync s3://waifuwave/models models - name: Build and push Docker image uses: docker/build-push-action@v4 with: context: . push: true tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} labels: ${{ steps.meta.outputs.labels }}