Update readme's, branches and actions
Build and Push Docker Images / detect-changes (push) Successful in 10s
Build and Push Docker Images / build-auth-api (push) Successful in 58s
Build and Push Docker Images / build-employee-api (push) Successful in 58s
Build and Push Docker Images / build-transit-api (push) Successful in 59s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m8s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m14s
Build and Push Docker Images / deploy-test-node (push) Successful in 5s
Build and Push Docker Images / detect-changes (push) Successful in 10s
Build and Push Docker Images / build-auth-api (push) Successful in 58s
Build and Push Docker Images / build-employee-api (push) Successful in 58s
Build and Push Docker Images / build-transit-api (push) Successful in 59s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m8s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m14s
Build and Push Docker Images / deploy-test-node (push) Successful in 5s
This commit is contained in:
@@ -3,43 +3,63 @@ name: Build and Push Docker Images
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
paths:
|
||||
- "auth_api/**"
|
||||
- "employee_api/**"
|
||||
- "transit_api/**"
|
||||
- "error_log_api/**"
|
||||
- "admin_ui/**"
|
||||
- "docker-compose.yml"
|
||||
- ".gitea/workflows/docker-build.yml"
|
||||
- dev
|
||||
- auth-api
|
||||
- employee-api
|
||||
- transit-api
|
||||
- error-log-api
|
||||
- admin-ui
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
- dev
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.testinstance.nl
|
||||
IMAGE_NAMESPACE: sven/the-transit-project
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
detect-changes:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: auth_api
|
||||
context: ./auth_api
|
||||
- name: employee_api
|
||||
context: ./employee_api
|
||||
- name: transit_api
|
||||
context: ./transit_api
|
||||
- name: error_log_api
|
||||
context: ./error_log_api
|
||||
- name: admin_ui
|
||||
context: ./admin_ui
|
||||
outputs:
|
||||
auth_api: ${{ steps.filter.outputs.auth_api }}
|
||||
employee_api: ${{ steps.filter.outputs.employee_api }}
|
||||
transit_api: ${{ steps.filter.outputs.transit_api }}
|
||||
error_log_api: ${{ steps.filter.outputs.error_log_api }}
|
||||
admin_ui: ${{ steps.filter.outputs.admin_ui }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Detect changed paths
|
||||
id: filter
|
||||
uses: dorny/paths-filter@v3
|
||||
with:
|
||||
filters: |
|
||||
auth_api:
|
||||
- 'auth_api/**'
|
||||
- 'docker-compose.yml'
|
||||
- '.gitea/workflows/docker-build.yml'
|
||||
employee_api:
|
||||
- 'employee_api/**'
|
||||
- 'docker-compose.yml'
|
||||
- '.gitea/workflows/docker-build.yml'
|
||||
transit_api:
|
||||
- 'transit_api/**'
|
||||
- 'docker-compose.yml'
|
||||
- '.gitea/workflows/docker-build.yml'
|
||||
error_log_api:
|
||||
- 'error_log_api/**'
|
||||
- 'docker-compose.yml'
|
||||
- '.gitea/workflows/docker-build.yml'
|
||||
admin_ui:
|
||||
- 'admin_ui/**'
|
||||
- 'docker-compose.yml'
|
||||
- '.gitea/workflows/docker-build.yml'
|
||||
|
||||
build-auth-api:
|
||||
needs: detect-changes
|
||||
if: ${{ (gitea.ref_name == 'auth-api' || gitea.ref_name == 'dev') && needs.detect-changes.outputs.auth_api == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -58,29 +78,170 @@ jobs:
|
||||
id: tags
|
||||
shell: bash
|
||||
run: |
|
||||
image_base="${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.name }}"
|
||||
image_tags="${image_base}:${{ gitea.sha }}"
|
||||
image_base="${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/auth_api"
|
||||
echo "tags<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.ref_name }}" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.sha }}" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
if [[ "${{ gitea.event_name }}" == "push" && "${{ gitea.ref_name }}" == "main" ]]; then
|
||||
image_tags+=$'\n'"${image_base}:latest"
|
||||
fi
|
||||
|
||||
{
|
||||
echo 'tags<<EOF'
|
||||
echo "$image_tags"
|
||||
echo 'EOF'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push
|
||||
- name: Build and push auth_api
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ${{ matrix.context }}
|
||||
context: ./auth_api
|
||||
push: ${{ gitea.event_name == 'push' }}
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
|
||||
build-employee-api:
|
||||
needs: detect-changes
|
||||
if: ${{ (gitea.ref_name == 'employee-api' || gitea.ref_name == 'dev') && needs.detect-changes.outputs.employee_api == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set image tags
|
||||
id: tags
|
||||
shell: bash
|
||||
run: |
|
||||
image_base="${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/employee_api"
|
||||
echo "tags<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.ref_name }}" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.sha }}" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push employee_api
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./employee_api
|
||||
push: ${{ gitea.event_name == 'push' }}
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
|
||||
build-transit-api:
|
||||
needs: detect-changes
|
||||
if: ${{ (gitea.ref_name == 'transit-api' || gitea.ref_name == 'dev') && needs.detect-changes.outputs.transit_api == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set image tags
|
||||
id: tags
|
||||
shell: bash
|
||||
run: |
|
||||
image_base="${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/transit_api"
|
||||
echo "tags<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.ref_name }}" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.sha }}" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push transit_api
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./transit_api
|
||||
push: ${{ gitea.event_name == 'push' }}
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
|
||||
build-error-log-api:
|
||||
needs: detect-changes
|
||||
if: ${{ (gitea.ref_name == 'error-log-api' || gitea.ref_name == 'dev') && needs.detect-changes.outputs.error_log_api == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set image tags
|
||||
id: tags
|
||||
shell: bash
|
||||
run: |
|
||||
image_base="${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/error_log_api"
|
||||
echo "tags<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.ref_name }}" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.sha }}" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push error_log_api
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./error_log_api
|
||||
push: ${{ gitea.event_name == 'push' }}
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
|
||||
build-admin-ui:
|
||||
needs: detect-changes
|
||||
if: ${{ (gitea.ref_name == 'admin-ui' || gitea.ref_name == 'dev') && needs.detect-changes.outputs.admin_ui == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set image tags
|
||||
id: tags
|
||||
shell: bash
|
||||
run: |
|
||||
image_base="${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/admin_ui"
|
||||
echo "tags<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.ref_name }}" >> "$GITHUB_OUTPUT"
|
||||
echo "${image_base}:${{ gitea.sha }}" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push admin_ui
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./admin_ui
|
||||
push: ${{ gitea.event_name == 'push' }}
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
|
||||
deploy-test-node:
|
||||
needs: build-and-push
|
||||
if: ${{ gitea.event_name == 'push' && gitea.ref_name == 'main' }}
|
||||
needs:
|
||||
[
|
||||
detect-changes,
|
||||
build-auth-api,
|
||||
build-employee-api,
|
||||
build-transit-api,
|
||||
build-error-log-api,
|
||||
build-admin-ui,
|
||||
]
|
||||
if: ${{ gitea.event_name == 'push' && gitea.ref_name == 'dev' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
Reference in New Issue
Block a user