-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
4 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 |
---|---|---|
|
@@ -67,7 +67,6 @@ jobs: | |
fi | ||
echo "new_version=${new_version}" >> $GITHUB_OUTPUT | ||
echo "the_version=${new_version}" >> $GITHUB_ENV | ||
poetry version ${new_version} | ||
- name: Install Dependencies and Run Tests | ||
|
@@ -102,8 +101,8 @@ jobs: | |
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git commit -am "/version ${{ env.the_version }}" | ||
git tag -a "${{ env.the_version }}" -m "Version ${{ env.the_version }}" | ||
git commit -am "/version ${{ env.new_version }}" | ||
git tag -a "${{ env.new_version }}" -m "Version ${{ env.new_version }}" | ||
git push --follow-tags | ||
- name: Create and Upload Release | ||
|
@@ -113,7 +112,7 @@ jobs: | |
startsWith(github.ref, 'refs/heads/release') | ||
uses: ncipollo/[email protected] | ||
with: | ||
tag: ${{ env.the_version }} | ||
tag: ${{ env.new_version }} | ||
artifacts: "*.zip" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
makeLatest: ${{ github.ref == 'refs/heads/main' }} | ||
|
@@ -172,13 +171,56 @@ jobs: | |
pip install tenacity logging | ||
python3 ${GITHUB_WORKSPACE}/.github/workflows/wait-for-pypi.py ${{needs.build.outputs.pyproject_name}}[harmony]==${{ needs.build.outputs.version }} | ||
- name: Set Environment Variables | ||
run: | | ||
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then | ||
echo "TARGET_ENV_UPPERCASE=SIT" >> $GITHUB_ENV | ||
elif [[ "${{ github.ref }}" =~ ^refs/heads/release/ ]]; then | ||
echo "TARGET_ENV_UPPERCASE=UAT" >> $GITHUB_ENV | ||
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
echo "TARGET_ENV_UPPERCASE=OPS" >> $GITHUB_ENV | ||
fi | ||
- name: Deploy Env Override | ||
if: contains(github.event.head_commit.message, '/deploy') | ||
run: | | ||
message="${{ github.event.head_commit.message }}" | ||
trimmed_message=${message:1} # Remove leading slash | ||
override_env=$(echo "$trimmed_message" | grep -oE '[^[:space:]]+$') | ||
override_env_upper=$(echo "$trimmed_message" | awk '{print toupper($NF)}') | ||
echo "TARGET_ENV_UPPERCASE=${override_env_upper}" >> $GITHUB_ENV | ||
- name: Lower Case Target Env | ||
run: | | ||
original_env_value="${TARGET_ENV_UPPERCASE}" | ||
lowercase_value=$(echo "${original_env_value}" | tr '[:upper:]' '[:lower:]') | ||
echo "TARGET_ENV_LOWERCASE=${lowercase_value}" >> $GITHUB_ENV | ||
- name: Extract metadata (tags, labels) for Docker | ||
if: | | ||
steps.pypi-test-publish.conclusion == 'success' || | ||
steps.pypi-publish.conclusion == 'success' || | ||
github.event.head_commit.message == '/deploy sit' || | ||
github.event.head_commit.message == '/deploy uat' || | ||
github.event.head_commit.message == '/deploy sandbox' | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=${{ github.ref == 'refs/heads/main' }} | ||
tags: | | ||
type=semver,pattern={{raw}},value=${{ needs.build.outputs.version }} | ||
type=raw,value=${{ env.TARGET_ENV_LOWERCASE }} | ||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ./docker/lambdaDockerfileArm | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/arm64 | ||
build-args: | | ||
DIST_PATH: ${{ contains(github.event.head_commit.message, '/deploy') && 'dist/' || '' }} | ||
|