Skip to content

Commit

Permalink
ops: workflow for trunk-based strategy (#94)
Browse files Browse the repository at this point in the history
* add on create deploy ms

* test

* test

* test

* test

* test

* fix test

* test

* test

* containes

* deploy functions

* remove auto assigne

* remove develop reference

* fix check_pr
  • Loading branch information
manuraf authored Jan 18, 2024
1 parent 0199073 commit ee4e627
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
3 changes: 0 additions & 3 deletions .github/auto_assign.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Check PR
on:
pull_request:
branches:
- develop
- main
types:
- opened
- synchronize
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Get total lines changed
run: |
size=$(git diff --stat origin/develop --diff-filter=d \
size=$(git diff --stat origin/main --diff-filter=d \
| grep -v .lock \
| awk -F"|" '{ print $2 }' \
| awk '{ print $1 }' \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/code_review_functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
branches:
- main
- develop
types:
- opened
- synchronize
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/code_review_libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
branches:
- main
- develop
types:
- opened
- synchronize
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/code_review_ms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request:
branches:
- main
- develop
types:
- opened
- synchronize
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/deploy_onboarding_functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ name: Deploy onboarding functions
on:
pull_request:
branches:
- develop
- main
types: [closed]
paths:
- "apps/onboarding-functions/**"
- "apps/pom.xml"
- "apps/pom.xml"
# deploy UAT when create a new branch release*, condition below contains() permit to execute worflow only for 'release' branch
create:

workflow_dispatch:
inputs:
Expand All @@ -22,14 +23,14 @@ on:
- prod

env:
ENV_NAME: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'prod' || (github.base_ref == 'develop' && 'uat' || 'dev')) }}"
ENV_NAME: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'dev' || (contains(github.ref_name, 'release') && 'uat' || 'dev')) }}"

jobs:
build:
name: Build Onboarding Functions
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true) }}
environment: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'prod' || (github.base_ref == 'develop' && 'uat' || 'dev')) }}-cd"
if: ${{ (github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true || contains(github.ref_name, 'release')) }}
environment: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'dev' || (contains(github.ref_name, 'release') && 'uat' || 'dev')) }}-ci"
permissions:
packages: write
contents: write
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/deploy_onboarding_ms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ name: Deploy onboarding ms
on:
pull_request:
branches:
- develop
- main
types: [closed]
paths:
- "apps/onboarding-ms/**"
- "apps/pom.xml"
# deploy UAT when create a new branch release*, condition below contains() permit to execute worflow only for 'release' branch
create:

workflow_dispatch:
inputs:
Expand All @@ -28,14 +29,14 @@ env:
# started workflows, it picks up the value coming from the UI; otherwise,
# it sets prod or uat depending on the current branch.
# Ternary operator is not supported
ENV_NAME: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'prod' || (github.base_ref == 'develop' && 'uat' || 'dev')) }}"
ENV_NAME: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'dev' || (contains(github.ref_name, 'release') && 'uat' || 'dev')) }}"

jobs:
build:
name: Build Onboarding Microservice
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true) }}
environment: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'prod' || (github.base_ref == 'develop' && 'uat' || 'dev')) }}-ci"
if: ${{ (github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true || contains(github.ref_name, 'release')) }}
environment: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'dev' || (contains(github.ref_name, 'release') && 'uat' || 'dev')) }}-ci"
outputs:
environment: ${{ steps.setenv.outputs.environment }}
short_sha: ${{ steps.setsha.outputs.short_sha }}
Expand Down

0 comments on commit ee4e627

Please sign in to comment.