forked from e-mission/em-public-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed to default .env file + Removing hardcoded branch name
- .env.tags file not being read by docker compose file SERVER_IMAGE_TAG also needs to be stored in .env file since docker compose file makes use of it. Branch name already included in image tag; hence removing
- Loading branch information
Mahadik, Mukul Chandrakant
authored and
Mahadik, Mukul Chandrakant
committed
Sep 21, 2024
1 parent
1f78e70
commit 2a61f4e
Showing
3 changed files
with
19 additions
and
15 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,3 @@ | ||
PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=2024-09-20--38-59 | ||
PUBLIC_DASH_FRONTEND_IMAGE_TAG=2024-09-20--29-15 | ||
SERVER_IMAGE_TAG=2024-09-20--58-50 |
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ jobs: | |
-H "Authorization: Bearer ${{ secrets.GH_FG_PAT_TAGS }}" \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/MukuFlash03/e-mission-server/contents/.env.tags?ref=cleanup-cicd) | ||
https://api.github.com/repos/MukuFlash03/e-mission-server/contents/.env?ref=cleanup-cicd) | ||
content=$(echo "$response" | jq -r .content) | ||
decoded_content=$(echo "$content" | base64 --decode) | ||
|
@@ -34,7 +34,7 @@ jobs: | |
- name: Set docker image tags | ||
id: set-tags | ||
run: | | ||
set -a; source .env.tags; set +a | ||
set -a; source .env; set +a | ||
echo "PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=${PUBLIC_DASH_NOTEBOOK_IMAGE_TAG}" >> "$GITHUB_OUTPUT" | ||
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${PUBLIC_DASH_FRONTEND_IMAGE_TAG}" >> "$GITHUB_OUTPUT" | ||
|
@@ -75,26 +75,27 @@ jobs: | |
fi | ||
docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}_notebook:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} | ||
- name: Update .env.tags file | ||
- name: Update .env file | ||
run: | | ||
echo "PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.date.outputs.date }}" > .env.tags | ||
echo "PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.date.outputs.date }}" > .env | ||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | ||
echo "Workflow_dispatch: Reuse existing frontend image tag" | ||
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.set-tags.outputs.PUBLIC_DASH_FRONTEND_IMAGE_TAG }}" >> .env.tags | ||
echo "Workflow_dispatch: Reuse existing frontend image tag" | ||
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.set-tags.outputs.PUBLIC_DASH_FRONTEND_IMAGE_TAG }}" >> .env | ||
else | ||
echo "Push event: Update frontend image tag" | ||
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.date.outputs.date }}" >> .env.tags | ||
echo "Push event: Update frontend image tag" | ||
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.date.outputs.date }}" >> .env | ||
fi | ||
echo "SERVER_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }}" >> .env | ||
- name: Add, Commit, Push changes to .env.tags file | ||
- name: Add, Commit, Push changes to .env file | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Github Actions bot to update .env.tags with latest tags" | ||
git config --local user.name "Github Actions bot to update .env with latest tags" | ||
if git diff --quiet; then | ||
echo "Latest timestamp already present in .env.tags file, no changes to commit" | ||
echo "Latest timestamp already present in .env file, no changes to commit" | ||
else | ||
git add .env.tags | ||
git commit -m "Updated docker image tags in .env.tags file to the latest timestamp" | ||
git add .env | ||
git commit -m "Updated docker image tags in .env file to the latest timestamp" | ||
git push origin | ||
fi | ||
|
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