name: build-prod on: push: branches: [prod] jobs: build-push: runs-on: docker permissions: packages: write contents: read env: REGISTRY: forgejo.riotpiao.com IMAGE_NAME: rock/kmsvc-manage REGISTRY_PAT: ${{ secrets.REGISTRY_PAT }} steps: - name: Checkout code uses: actions/checkout@v4 - name: Get commit short SHA id: short_sha run: echo "sha=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Forgejo Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: rock password: ${{ env.REGISTRY_PAT }} - name: Extract metadata (tags, labels) id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=${{ steps.short_sha.outputs.sha }} type=raw,value=latest,enable={{is_default_branch}} - name: Build and push image uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max