diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..8769ce0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Build and Push Docker Image to GitHub Container Registry + +on: + push: + branches: + - main # Trigger on push to the main branch + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker image + run: | + docker build -t ghcr.io/sonichigo/wallpaper-ai:${{ github.sha }} . + - name: Push Docker image + run: | + docker push ghcr.io/sonichigo/wallpaper-ai:${{ github.sha }} + - name: Tag latest image + run: | + docker tag ghcr.io/sonichigo/wallpaper-ai:${{ github.sha }} ghcr.io/sonichigo/wallpaper-ai:latest + - name: Push the "latest" tag + run: | + docker push ghcr.io/sonichigo/wallpaper-ai:latest