-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1866 from ytqsl/tasks/EMBCEDDMOD-4876
EMBCESSMOD-4876: refactored ci/cd into templated build workflow
- Loading branch information
Showing
33 changed files
with
407 additions
and
934 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: oauth-server Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'release/**' | ||
paths: | ||
- "oauth-server/src/API/**" | ||
- .github/workflows/build-oauth-server.yml | ||
- .github/workflows/build-template.yml | ||
|
||
pull_request: | ||
paths: | ||
- "oauth-server/src/API/**" | ||
- .github/workflows/build-oauth-server.yml | ||
- .github/workflows/build-template.yml | ||
|
||
jobs: | ||
build: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: oauth-server/src/API | ||
IMAGE_FILE: oauth-server/src/API/Dockerfile | ||
IMAGE_NAME: oauth-server | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: ess-backend Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'release/**' | ||
paths: | ||
- "ess/src/API/**" | ||
- "shared/src/**" | ||
- .github/workflows/build-ess-backend.yml | ||
- .github/workflows/build-template.yml | ||
|
||
pull_request: | ||
paths: | ||
- "ess/src/API/**" | ||
- "shared/src/**" | ||
- .github/workflows/build-ess-backend.yml | ||
- .github/workflows/build-template.yml | ||
|
||
jobs: | ||
build: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: ess/src/API | ||
BUILD_CONTEXT: "shared=./shared/src" | ||
IMAGE_FILE: ess/src/API/Dockerfile | ||
IMAGE_NAME: ess-backend | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: landing-page Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'release/**' | ||
paths: | ||
- "landing-page/src/**" | ||
- .github/workflows/build-landing-page.yml | ||
- .github/workflows/build-template.yml | ||
|
||
pull_request: | ||
paths: | ||
- "landing-page/src/**" | ||
- .github/workflows/build-landing-page.yml | ||
- .github/workflows/build-template.yml | ||
|
||
jobs: | ||
build: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: landing-page/src | ||
IMAGE_FILE: landing-page/src/Dockerfile | ||
IMAGE_NAME: landing-page | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: registrant-portal-api Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'release/**' | ||
paths: | ||
- "registrants/src/API/**" | ||
- "registrants/src/UI/**" | ||
- "shared/src/**" | ||
- .github/workflows/build-registrants-portal.yml | ||
- .github/workflows/build-template.yml | ||
|
||
pull_request: | ||
paths: | ||
- "registrants/src/API/**" | ||
- "registrants/src/UI/**" | ||
- "shared/src/**" | ||
- .github/workflows/build-registrants-portal.yml | ||
- .github/workflows/build-template.yml | ||
|
||
jobs: | ||
build-api: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: registrants/src/API | ||
BUILD_CONTEXT: "shared=./shared/src" | ||
IMAGE_FILE: registrants/src/API/Dockerfile | ||
IMAGE_NAME: registrants-portal-api | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
build-ui: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: registrants/src/UI | ||
IMAGE_FILE: registrants/src/UI/Dockerfile | ||
IMAGE_NAME: registrants-portal-ui | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: responders-portal-api Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'release/**' | ||
paths: | ||
- "responders/src/API/**" | ||
- "responders/src/UI/**" | ||
- "shared/src/**" | ||
- .github/workflows/build-responders-portal.yml | ||
- .github/workflows/build-template.yml | ||
|
||
pull_request: | ||
paths: | ||
- "responders/src/API/**" | ||
- "responders/src/UI/**" | ||
- "shared/src/**" | ||
- .github/workflows/build-responders-portal.yml | ||
- .github/workflows/build-template.yml | ||
|
||
jobs: | ||
build-api: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: responders/src/API | ||
BUILD_CONTEXT: "shared=./shared/src" | ||
IMAGE_FILE: responders/src/API/Dockerfile | ||
IMAGE_NAME: responders-portal-api | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
build-ui: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: responders/src/UI | ||
IMAGE_FILE: responders/src/UI/Dockerfile | ||
IMAGE_NAME: responders-portal-ui | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: suppliers-portal-api Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'release/**' | ||
paths: | ||
- "suppliers/src/API/**" | ||
- "suppliers/src/UI/**" | ||
- "shared/src/**" | ||
- .github/workflows/build-suppliers-portal.yml | ||
- .github/workflows/build-template.yml | ||
|
||
pull_request: | ||
paths: | ||
- "suppliers/src/API/**" | ||
- "suppliers/src/UI/**" | ||
- "shared/src/**" | ||
- .github/workflows/build-suppliers-portal.yml | ||
- .github/workflows/build-template.yml | ||
|
||
jobs: | ||
build-api: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: suppliers/src/API | ||
IMAGE_FILE: suppliers/src/API/Dockerfile | ||
IMAGE_NAME: suppliers-portal-api | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
build-ui: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
uses: ./.github/workflows/build-template.yml | ||
with: | ||
IMAGE_CONTEXT: suppliers/src/UI | ||
IMAGE_FILE: suppliers/src/UI/Dockerfile | ||
IMAGE_NAME: suppliers-portal-ui | ||
REGISTRY: ${{ vars.DOCKER_REGISTRY }} | ||
secrets: | ||
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: docker-build-template | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
IMAGE_CONTEXT: | ||
required: true | ||
type: string | ||
BUILD_CONTEXT: | ||
required: false | ||
type: string | ||
default: "" | ||
IMAGE_FILE: | ||
required: true | ||
type: string | ||
IMAGE_NAME: | ||
required: true | ||
type: string | ||
REGISTRY: | ||
required: true | ||
type: string | ||
|
||
secrets: | ||
REGISTRY_USER: | ||
required: true | ||
REGISTRY_PASSWORD: | ||
required: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Set up BuildKit Docker container builder to be able to build | ||
# multi-platform images and export cache | ||
# https://github.com/docker/setup-buildx-action | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ inputs.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ inputs.REGISTRY }} | ||
username: ${{ secrets.REGISTRY_USER }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ inputs.REGISTRY }}/${{ inputs.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ inputs.IMAGE_CONTEXT }} | ||
build-contexts: ${{ inputs.BUILD_CONTEXT }} | ||
file: ${{ inputs.IMAGE_FILE }} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
# labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
Oops, something went wrong.