Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #95

Merged
merged 5 commits into from
Oct 24, 2024
Merged

Dev #95

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions .github/workflows/docker-build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
echo "Environment: $TARGET_ENV JFROG_REPO_PATH=$JFROG_REPO_PATH"
echo "..."
env | sort
GenerateTag:
BranchInfo:
needs: [Setup]
runs-on: ubuntu-latest
environment: dev
Expand All @@ -60,38 +60,28 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get short commitId
id: get-commit
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get current date
id: date-selector
run: echo "date=$(date +'%B %e, %Y')" >> $GITHUB_OUTPUT
- name: Generate Next Git Tag
id: tag-selector
run: |
# Extract the major.minor.patch version parts using grep
MAJOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '^[0-9]+')
MINOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '\.[0-9]+\.' | grep -oE '[0-9]+')
VERSION_PATCH=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '[0-9]+$')
# Increment version elements
echo "${{env.UGM_RELEASE_PREFIX}}$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH"
VERSION_PATCH=$((VERSION_PATCH + 1))
echo "${{env.UGM_RELEASE_PREFIX}}$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH"
# Prepare tags
echo "gittag=${{env.UGM_RELEASE_PREFIX}}${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}" >> $GITHUB_OUTPUT
echo "tagmsg=${{env.UGM_RELEASE_MESSAGE}} ${{steps.date-selector.outputs.date}}" >> $GITHUB_OUTPUT
echo "tagversion=$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH" >> $GITHUB_OUTPUT
- name: Create Git Tag
- name: List merged branches
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions@users.noreply.github.com"
git tag -a "${{steps.tag-selector.outputs.gittag}}" -m "${{steps.tag-selector.outputs.tagmsg}}"
git push origin "${{steps.tag-selector.outputs.gittag}}"
git fetch --all
MERGED_BRANCHES=$(git branch -r --merged ${{env.TARGET_ENV}} | sed 's/origin\///')
echo "Merged branches: $MERGED_BRANCHES"
echo "MERGED_BRANCHES=$MERGED_BRANCHES" >> $GITHUB_ENV
- name: Set repository version variable
id: setversion
run: |
gh variable list --env ${{env.TARGET_ENV}}
gh variable set UGM_BUILD_VERSION --env ${{env.TARGET_ENV}} --body "${{steps.tag-selector.outputs.tagversion}}"
gh variable set UGM_BUILD_REVISION --env ${{env.TARGET_ENV}} --body "${{steps.get-commit.outputs.sha_short}}"
gh variable list --env ${{env.TARGET_ENV}}
echo "buildArgs UNITY_BUILD_VERSION: ${{env.UGM_BUILD_VERSION}}, UNITY_BUILD_REVISION: ${{env.UGM_BUILD_REVISION}}"
Build:
needs: [Setup,GenerateTag]
needs: [Setup,BranchInfo]
runs-on: ubuntu-latest
environment: dev
steps:
Expand Down
58 changes: 32 additions & 26 deletions .github/workflows/docker-build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ on:
- 'SECURITY.md'

env:
TARGET_ENV: test
TARGET_ENV: main
GH_TOKEN: ${{secrets.GH_API_TOKEN}}
OC_CLUSTER: ${{ vars.OPENSHIFT_CLUSTER }}
OC_REGISTRY: ${{ vars.OPENSHIFT_REGISTRY }}
OC_AUTH_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
Expand All @@ -31,15 +32,15 @@ env:
UGM_BUILD_REVISION: ${{vars.UGM_BUILD_REVISION}}

UGM_RELEASE_PREFIX: API_v
UGM_RELEASE_MESSAGE: Test
UGM_RELEASE_MESSAGE: "Production deployment"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
setup:
Setup:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
environment: test
environment: main
steps:
# Runs commands using the runners shell
- name: Get variables
Expand All @@ -50,53 +51,58 @@ jobs:
echo "Environment: $TARGET_ENV JFROG_REPO_PATH=$JFROG_REPO_PATH"
echo "..."
env | sort

# This workflow contains jobs called "GenerateTag" "PushTag" "Build"
GenerateTag:
needs: [Setup]
runs-on: ubuntu-latest
environment: test
environment: main
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get short commitId
id: get-commit
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get current date
id: date-selector
run: echo "date=$(date +'%B %e, %Y')" >> $GITHUB_OUTPUT
- name: Generate Next Git Tag
id: tag-selector
run: |
# Extract the major and minor version parts using grep
# Extract the major.minor.patch version parts using grep
MAJOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '^[0-9]+')
MINOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '\.[0-9]+' | grep -oE '[0-9]+')
MINOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '\.[0-9]+\.' | grep -oE '[0-9]+')
VERSION_PATCH=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '[0-9]+$')
VERSION_PATCH=$((VERSION_PATCH + 1))
# Construct the new tag
NEW_TAG="${{env.UGM_RELEASE_PREFIX}}${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}"
echo "${{env.UGM_RELEASE_PREFIX}}${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}"
echo "$(NEW_TAG)"
echo "gittag=${NEW_TAG}" >> $GITHUB_OUTPUT
# Increment version elements
echo "${{env.UGM_RELEASE_PREFIX}}$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH"
MINOR_VERSION=$((MINOR_VERSION + 1))
echo "${{env.UGM_RELEASE_PREFIX}}$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH"
# Prepare tags
echo "gittag=${{env.UGM_RELEASE_PREFIX}}${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}" >> $GITHUB_OUTPUT
echo "tagmsg=${{env.UGM_RELEASE_MESSAGE}} ${{steps.date-selector.outputs.date}}" >> $GITHUB_OUTPUT
echo "tagversion=${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}" >> $GITHUB_OUTPUT
echo "tagversion=$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH" >> $GITHUB_OUTPUT
- name: Create Git Tag
run: |
git config user.name "GitHub Actions 1"
git config user.name "GitHub Actions"
git config user.email "github-actions@users.noreply.github.com"
git tag -a "${{steps.tag-selector.outputs.gittag}}" -m "${{steps.tag-selector.outputs.tagmsg}}"
git push origin "${{steps.tag-selector.outputs.gittag}}"
- name: Set repository version variable
id: setversion
run: |
gh variable list --env test
gh variable set UGM_BUILD_VERSION --env test --body "1.1.1"
outputs:
TAGNAME: ${{steps.tag-selector.outputs.gittag}}
TAGMESSAGE: ${{steps.tag-selector.outputs.tagmsg}}
TAGPATCH: ${{steps.tag-selector.outputs.tagversion}}

build:
gh variable list --env ${{env.TARGET_ENV}}
gh variable set UGM_BUILD_REVISION --env ${{env.TARGET_ENV}} --body "${{steps.get-commit.outputs.sha_short}}"
gh variable set UGM_BUILD_VERSION --env ${{env.TARGET_ENV}} --body "${{steps.tag-selector.outputs.tagversion}}"
gh variable list --env ${{env.TARGET_ENV}}
# Update lower environment version elements
gh variable set UGM_BUILD_VERSION --env dev --body "${{steps.tag-selector.outputs.tagversion}}"
gh variable list --env dev
echo "buildArgs --env ${{env.TARGET_ENV}} UNITY_BUILD_VERSION: ${{env.UGM_BUILD_VERSION}}, UNITY_BUILD_REVISION: ${{env.UGM_BUILD_REVISION}}"
Build:
needs: [Setup,GenerateTag]
runs-on: ubuntu-latest
environment: test
environment: main
steps:
- uses: actions/checkout@v4
- name: Build dotnetapp docker images
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/docker-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ jobs:
echo "Environment: $TARGET_ENV JFROG_REPO_PATH=$JFROG_REPO_PATH"
echo "..."
env | sort
BranchInfo:
needs: [Setup]
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get short commitId
id: get-commit
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get current date
id: date-selector
run: echo "date=$(date +'%B %e, %Y')" >> $GITHUB_OUTPUT
- name: List merged branches
run: |
git fetch --all
MERGED_BRANCHES=$(git branch -r --merged ${{env.TARGET_ENV}} | sed 's/origin\///')
echo "Merged branches: $MERGED_BRANCHES"
echo "MERGED_BRANCHES=$MERGED_BRANCHES" >> $GITHUB_ENV
GenerateTag:
needs: [Setup]
runs-on: ubuntu-latest
Expand All @@ -60,6 +82,10 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get short commitId
id: get-commit
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get current date
id: date-selector
run: echo "date=$(date +'%B %e, %Y')" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -88,13 +114,15 @@ jobs:
id: setversion
run: |
gh variable list --env ${{env.TARGET_ENV}}
gh variable set UGM_BUILD_REVISION --env ${{env.TARGET_ENV}} --body "${{steps.get-commit.outputs.sha_short}}"
gh variable set UGM_BUILD_VERSION --env ${{env.TARGET_ENV}} --body "${{steps.tag-selector.outputs.tagversion}}"
gh variable list --env ${{env.TARGET_ENV}}
# Update lower environment version elements
gh variable set UGM_BUILD_VERSION --env dev --body "${{steps.tag-selector.outputs.tagversion}}"
gh variable list --env dev
echo "buildArgs --env ${{env.TARGET_ENV}} UNITY_BUILD_VERSION: ${{env.UGM_BUILD_VERSION}}, UNITY_BUILD_REVISION: ${{env.UGM_BUILD_REVISION}}"
Build:
needs: [Setup,GenerateTag]
needs: [Setup,BranchInfo,GenerateTag]
runs-on: ubuntu-latest
environment: test
steps:
Expand Down
5 changes: 5 additions & 0 deletions applications/scripts/datafix-ab#006.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test 1
test 2
test 3
test 4
test 5