Skip to content

Commit 3fb32c4

Browse files
authored
Update docker-image.yml
1 parent a4db3aa commit 3fb32c4

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

.github/workflows/docker-image.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,56 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11+
1112
steps:
1213
- name: Checkout repository
1314
uses: actions/checkout@v3
1415

16+
- name: Generate Timestamp Tag
17+
id: tag
18+
run: |
19+
TAG=$(date -u +"%Y%m%d-%H%M%S")
20+
echo "IMAGE_TAG=$TAG" >> $GITHUB_ENV
21+
echo "Image tag: $TAG"
22+
1523
- name: Login to Docker Hub
1624
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
1725

1826
- name: Build and Push Docker Image
1927
id: docker_build
2028
run: |
21-
docker build -t shizarizvi/texpose .
22-
docker tag shizarizvi/texpose shizarizvi/texpose-app:latest
23-
docker push shizarizvi/texpose-app:latest
29+
docker build -t shizarizvi/texpose:${{ env.IMAGE_TAG }} .
30+
docker tag shizarizvi/texpose:${{ env.IMAGE_TAG }} shizarizvi/texpose:latest
31+
docker push shizarizvi/texpose:${{ env.IMAGE_TAG }}
32+
docker push shizarizvi/texpose:latest
2433
continue-on-error: true
2534

2635
- name: Send Email Notification
27-
if: always() # Run this step regardless of success or failure
36+
if: always()
2837
uses: dawidd6/action-send-mail@v3
2938
with:
3039
server_address: smtp.gmail.com
3140
server_port: 587
3241
username: ${{ secrets.EMAIL_USERNAME }}
3342
password: ${{ secrets.EMAIL_PASSWORD }}
34-
subject: "Docker Image Build Status: ${{ job.status }}"
43+
subject: "Docker Image Build Status: ${{ job.status }} (Tag: ${{ env.IMAGE_TAG }})"
3544
to: "rizvi4400482@cloud.neduet.edu.pk"
3645
from: "GitHub Actions <${{ secrets.EMAIL_USERNAME }}>"
3746
body: |
3847
Hello,
3948
40-
The Docker image build process has completed with status: ${{ job.status }}
49+
The Docker image build has completed with status: ${{ job.status }}
4150
4251
Repository: ${{ github.repository }}
4352
Commit: ${{ github.sha }}
4453
Branch: ${{ github.ref_name }}
4554
Workflow: ${{ github.workflow }}
4655
Run: ${{ github.run_id }}
4756
57+
Docker Tags:
58+
- shizarizvi/texpose:${{ env.IMAGE_TAG }}
59+
- shizarizvi/texpose:latest
60+
4861
Check details at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
4962
5063
Best,

0 commit comments

Comments
 (0)