diff --git a/.github/workflows/deploy-ghcr.yml b/.github/workflows/deploy-ghcr.yml new file mode 100644 index 0000000..cb16568 --- /dev/null +++ b/.github/workflows/deploy-ghcr.yml @@ -0,0 +1,35 @@ +name: Deploy to GHCR + +on: + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract version from build.gradle + id: version + run: echo "version=$(grep '^ version' build.gradle | sed 's/.*\"\(.*\)\".*/\1/')" >> $GITHUB_OUTPUT + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ghcr.io/alleslockr/alleslocker-backend:latest + ghcr.io/alleslockr/alleslocker-backend:${{ steps.version.outputs.version }}