name: Build and Push on: push: branches: - master pull_request: branches: - master permissions: contents: read packages: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository_owner }}/ultimate-asepharyana.tech/gmw jobs: build: runs-on: ubuntu-latest if: github.event_name == "push" && github.ref == "refs/heads/master" steps: - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - name: Normalize image name run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> "$GITHUB_ENV" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image uses: docker/build-push-action@v6 with: context: . push: true tags: | ghcr.io/${{ env.IMAGE_NAME }}:latest ghcr.io/${{ env.IMAGE_NAME }}:sha-${{ github.sha }} cache-from: type=gha cache-to: type=gha,mode=max