name: Build and Upload {{ micro-service }} image env: REGISTRY: ghcr.io IMAGE_NAME: {{ micro-service }} on: workflow_dispatch: push: branches: - main paths: - "{{ micro-service }}/**" - "internal/{{ micro-service-dependency-1 }}/**" - "internal/{{ micro-service-dependency-2 }}/**" jobs: build: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b - name: Docker meta id: meta uses: docker/metadata-action@b2391d37b4157fa4aa2e118d643f417910ff3242 with: images: | ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch - name: Set up Docker Buildx id: docker-setup uses: docker/setup-buildx-action@f211e3e9ded2d9377c8cadc4489a4e38014bc4c9 - name: Log in to the Container registry id: docker-login uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push constellation-{{ micro-service }} container image id: build-constellation-{{ micro-service }} uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a with: context: . file: {{ micro-service }}/Dockerfile target: release push: true tags: ${{ steps.meta.outputs.tags }}