Skip to content

Add dynamic image tag using current timestamp #7

Add dynamic image tag using current timestamp

Add dynamic image tag using current timestamp #7

Workflow file for this run

name: Docker Image CI
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE_TAG: my-image-name:$(date +%s)
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_Token }}
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ghcr.io/${{ github.repository }}/${{ env.IMAGE_TAG }}
- name: Push the Docker image
run: docker push ghcr.io/${{ github.repository }}/${{ env.IMAGE_TAG }}