diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8c5b5e..6f593a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ on: permissions: contents: read + packages: write # --> Allows Github Actions to upload to the Container Registery jobs: lint-and-typecheck: @@ -37,16 +38,26 @@ jobs: needs: [lint-and-typecheck] steps: - uses: actions/checkout@v4 + - name: Login to Container Registery + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + + - name: Lowercase Repository Name + run: | + echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} - name: Build Docker Image uses: docker/build-push-action@v5 with: context: . - push: false # We only want to test the build, not push it to a registry yet - tags: systemcraft-web:latest + push: ${{ github.event_name != 'pull_request' }} + tags: ghcr.io/${{ env.REPO }}/systemcraft-web:latest cache-from: type=gha cache-to: type=gha,mode=max build-args: |