Skip to content

Commit

Permalink
chore: adding date tag
Browse files Browse the repository at this point in the history
  • Loading branch information
huniafatima-arbi committed Nov 7, 2024
1 parent a466d2a commit 84ab16a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/push-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ jobs:
images: ${{ fromJson(needs.set-matrix.outputs.docker_images) }}

steps:
- name: Get tag name
id: get-tag-name
- name: Get publish date
id: get-publish-date
uses: actions/github-script@v7
with:
script: |
const tagName = "${{ github.event.inputs.branch }}" || 'latest';
console.log('Will use tag: ' + tagName);
return tagName;
const date = new Date();
const year = date.getUTCFullYear();
const month = String(date.getUTCMonth() + 1).padStart(2, '0');
const day = String(date.getUTCDate()).padStart(2, '0');
const dateTag = `${year}${month}${day}`;
return dateTag
result-encoding: string

- name: Set up Docker Buildx
Expand All @@ -74,17 +77,14 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Set build date tag
run: echo "PUBLISH_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV

- name: Build and push Dev Docker image
uses: docker/build-push-action@v6
with:
file: ./dockerfiles/${{matrix.images.dockerfile || matrix.images.image_name}}.Dockerfile
push: true
platforms: ${{ matrix.images.os_platform }}
target: ${{ matrix.images.target }}
tags: edxops/${{matrix.images.image_name}}-dev:test, edxops/${{matrix.images.image_name}}-dev:$BUILD_DATE
tags: edxops/${{matrix.images.image_name}}-dev:test, edxops/${{matrix.images.image_name}}-dev:${{ steps.get-publish-date.outputs.result }}
# ${{ steps.get-tag-name.outputs.result }}

- name: Send failure notification
Expand Down

0 comments on commit 84ab16a

Please sign in to comment.