forked from e-mission/e-mission-server
-
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.
Testing semver pattern without value
- Loading branch information
1 parent
2782113
commit 7641a65
Showing
1 changed file
with
76 additions
and
76 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 |
---|---|---|
|
@@ -97,11 +97,11 @@ jobs: | |
# images: | | ||
# name/app | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
# type=semver,pattern=v{{version}} | ||
# type=ref,event=branch | ||
# type=ref,event=tag | ||
type=semver,pattern=v{{version}} | ||
# type=semver,pattern=v{{version}},value=${{ steps.fetch-latest-release-tags.outputs.tag_name }} | ||
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', inputs.branch ) }} | ||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', inputs.branch ) }} | ||
- name: Login to DockerHub | ||
# if: github.event_name != 'pull_request' | ||
|
@@ -110,79 +110,79 @@ jobs: | |
username: ${{ env.DOCKER_USER }} | ||
password: ${{ env.DOCKER_PASSWORD }} | ||
|
||
- name: Get current date # get the date of the build | ||
id: date | ||
run: echo "date=$(date +'%Y-%m-%d--%M-%S')" >> "$GITHUB_OUTPUT" | ||
# - name: Get current date # get the date of the build | ||
# id: date | ||
# run: echo "date=$(date +'%Y-%m-%d--%M-%S')" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Run a one-line script | ||
run: echo running image build for repo ${{ inputs.repo }} branch ${{ inputs.branch }} on ${{ steps.date.outputs.date }} | ||
# - name: Run a one-line script | ||
# run: echo running image build for repo ${{ inputs.repo }} branch ${{ inputs.branch }} on ${{ steps.date.outputs.date }} | ||
|
||
- name: build docker image | ||
run: | | ||
if [ "${{ inputs.repo }}" = "e-mission-server" ]; then | ||
docker build -t $DOCKER_USER/${{ inputs.repo }}:${{ inputs.branch }}_${{ steps.date.outputs.date }} . | ||
elif [ "${{ inputs.repo }}" = "nrel-openpath-join-page" ]; then | ||
docker build -t $DOCKER_USER/${{ inputs.repo }}:${{ inputs.branch }}_${{ steps.date.outputs.date }} ./frontend | ||
elif [ "${{ inputs.repo }}" = "op-admin-dashboard" ]; then | ||
SERVER_IMAGE_TAG=${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }} docker compose -f docker-compose-prod.yml build | ||
elif [ "${{ inputs.repo }}" = "em-public-dashboard" ]; then | ||
SERVER_IMAGE_TAG=${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }} docker compose -f docker-compose.yml build | ||
fi | ||
docker images | ||
- name: rename docker image | ||
run: | | ||
if [ "${{ inputs.repo }}" = "op-admin-dashboard" ]; then | ||
docker image tag e-mission/opdash:0.0.1 $DOCKER_USER/${{ inputs.repo }}:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
elif [ "${{ inputs.repo }}" = "em-public-dashboard" ]; then | ||
if [ "${{ github.event_name }}" == "push" ]; then | ||
docker image tag em-pub-dash-prod/frontend:latest $DOCKER_USER/${{ inputs.repo }}_frontend:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
fi | ||
docker image tag em-pub-dash-prod/viz-scripts:latest $DOCKER_USER/${{ inputs.repo }}_notebook:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
fi | ||
# - name: build docker image | ||
# run: | | ||
# if [ "${{ inputs.repo }}" = "e-mission-server" ]; then | ||
# docker build -t $DOCKER_USER/${{ inputs.repo }}:${{ inputs.branch }}_${{ steps.date.outputs.date }} . | ||
# elif [ "${{ inputs.repo }}" = "nrel-openpath-join-page" ]; then | ||
# docker build -t $DOCKER_USER/${{ inputs.repo }}:${{ inputs.branch }}_${{ steps.date.outputs.date }} ./frontend | ||
# elif [ "${{ inputs.repo }}" = "op-admin-dashboard" ]; then | ||
# SERVER_IMAGE_TAG=${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }} docker compose -f docker-compose-prod.yml build | ||
# elif [ "${{ inputs.repo }}" = "em-public-dashboard" ]; then | ||
# SERVER_IMAGE_TAG=${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }} docker compose -f docker-compose.yml build | ||
# fi | ||
# docker images | ||
|
||
# - name: rename docker image | ||
# run: | | ||
# if [ "${{ inputs.repo }}" = "op-admin-dashboard" ]; then | ||
# docker image tag e-mission/opdash:0.0.1 $DOCKER_USER/${{ inputs.repo }}:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
# elif [ "${{ inputs.repo }}" = "em-public-dashboard" ]; then | ||
# if [ "${{ github.event_name }}" == "push" ]; then | ||
# docker image tag em-pub-dash-prod/frontend:latest $DOCKER_USER/${{ inputs.repo }}_frontend:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
# fi | ||
# docker image tag em-pub-dash-prod/viz-scripts:latest $DOCKER_USER/${{ inputs.repo }}_notebook:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
# fi | ||
|
||
- name: push docker image | ||
run: | | ||
if [ "${{ inputs.repo }}" = "em-public-dashboard" ]; then | ||
if [ "${{ github.event_name }}" == "push" ]; then | ||
docker push $DOCKER_USER/${{ inputs.repo }}_frontend:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
fi | ||
docker push $DOCKER_USER/${{ inputs.repo }}_notebook:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
else | ||
docker push $DOCKER_USER/${{ inputs.repo }}:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
fi | ||
# - name: push docker image | ||
# run: | | ||
# if [ "${{ inputs.repo }}" = "em-public-dashboard" ]; then | ||
# if [ "${{ github.event_name }}" == "push" ]; then | ||
# docker push $DOCKER_USER/${{ inputs.repo }}_frontend:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
# fi | ||
# docker push $DOCKER_USER/${{ inputs.repo }}_notebook:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
# else | ||
# docker push $DOCKER_USER/${{ inputs.repo }}:${{ inputs.branch }}_${{ steps.date.outputs.date }} | ||
# fi | ||
|
||
- name: Update .env file | ||
run: | | ||
if [ "${{ inputs.repo }}" = "e-mission-server" ]; then | ||
echo "SERVER_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" > .env | ||
elif [ "${{ inputs.repo }}" = "nrel-openpath-join-page" ]; then | ||
echo "JOIN_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" > .env | ||
elif [ "${{ inputs.repo }}" = "op-admin-dashboard" ]; then | ||
echo "ADMIN_DASH_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" > .env | ||
echo "SERVER_IMAGE_TAG=${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }}" >> .env | ||
elif [ "${{ inputs.repo }}" = "em-public-dashboard" ]; then | ||
echo "PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" > .env | ||
if [ "${{ github.event_name }}" == "push" ]; then | ||
echo "Push event: Update frontend image tag" | ||
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" >> .env | ||
else | ||
echo "Workflow_dispatch: Reuse existing frontend image tag" | ||
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${{ steps.set-tags.outputs.PUBLIC_DASH_FRONTEND_IMAGE_TAG }}" >> .env | ||
fi | ||
echo "SERVER_IMAGE_TAG=${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }}" >> .env | ||
fi | ||
cat .env | ||
- 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 with latest tags" | ||
if git diff --quiet; then | ||
echo "Latest timestamp already present in .env file, no changes to commit" | ||
else | ||
git add .env | ||
git commit -m "Updated docker image tags in .env file to the latest timestamp" | ||
git push origin | ||
fi | ||
cat .env | ||
# - name: Update .env file | ||
# run: | | ||
# if [ "${{ inputs.repo }}" = "e-mission-server" ]; then | ||
# echo "SERVER_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" > .env | ||
# elif [ "${{ inputs.repo }}" = "nrel-openpath-join-page" ]; then | ||
# echo "JOIN_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" > .env | ||
# elif [ "${{ inputs.repo }}" = "op-admin-dashboard" ]; then | ||
# echo "ADMIN_DASH_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" > .env | ||
# echo "SERVER_IMAGE_TAG=${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }}" >> .env | ||
# elif [ "${{ inputs.repo }}" = "em-public-dashboard" ]; then | ||
# echo "PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" > .env | ||
# if [ "${{ github.event_name }}" == "push" ]; then | ||
# echo "Push event: Update frontend image tag" | ||
# echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${{ inputs.branch }}_${{ steps.date.outputs.date }}" >> .env | ||
# else | ||
# echo "Workflow_dispatch: Reuse existing frontend image tag" | ||
# echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${{ steps.set-tags.outputs.PUBLIC_DASH_FRONTEND_IMAGE_TAG }}" >> .env | ||
# fi | ||
# echo "SERVER_IMAGE_TAG=${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }}" >> .env | ||
# fi | ||
# cat .env | ||
|
||
# - 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 with latest tags" | ||
# if git diff --quiet; then | ||
# echo "Latest timestamp already present in .env file, no changes to commit" | ||
# else | ||
# git add .env | ||
# git commit -m "Updated docker image tags in .env file to the latest timestamp" | ||
# git push origin | ||
# fi | ||
# cat .env |