Merge pull request #117 from SAP-samples/github-actions-versions-update #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'endresult' | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build_and_push_business-partner-mock: | |
name: Business Partner Mock | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-business-partner-mock | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/easyfranchise/deployment/docker/Dockerfile-business-partner-mock | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_broker: | |
name: SaaS Broker | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-broker | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/easyfranchise/deployment/docker/Dockerfile-broker | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_approuter: | |
name: Approuter | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-approuter | |
- name: Build Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./code/easyfranchise/deployment/docker/Dockerfile-approuter | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_bp_service: | |
name: Business Partner Service | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-bp-service | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/easyfranchise/deployment/docker/Dockerfile-bp-service | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_db_service: | |
name: DB Service | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-db-service | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/easyfranchise/deployment/docker/Dockerfile-db-service | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_ef_service: | |
name: EasyFranchise Service | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ef-service | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/easyfranchise/deployment/docker/Dockerfile-ef-service | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_email-service: | |
name: Email Service | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-email-service | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/easyfranchise/deployment/docker/Dockerfile-email-service | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_ui: | |
name: UI | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ui | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/easyfranchise/deployment/docker/Dockerfile-ui | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_day2_approuter: | |
name: Day2-Approuter | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-day2-approuter | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/day2-operations/deployment/docker/Dockerfile-day2-approuter | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_day2_ui: | |
name: Day2-UI | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-day2-ui | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./code/day2-operations/deployment/docker/Dockerfile-day2-ui | |
build-args: | | |
EASYFRANCHISE_VERSION_GIT_ARG=${{ steps.vars.outputs.sha_short }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build_and_push_day2_service: | |
name: Day2-Service | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get commit id | |
id: vars | |
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-day2-service | |
- name: Run build script | |
working-directory: ./code/day2-operations/source/day2-service | |
run: | | |
sudo chmod 777 mvnw | |
./mvnw spring-boot:build-image -DskipTests=true -Dspring-boot.build-image.imageName="${{ steps.meta.outputs.tags }}" | |
docker push "${{ steps.meta.outputs.tags }}" |