From 506e5488f7eb78d63bb60def7266c0ea0547c7ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonia=20Melga=C3=A7o?= Date: Fri, 27 Jan 2023 17:03:54 -0300 Subject: [PATCH] cd: add timestamp label to images --- .github/workflows/release.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5205424..3223039 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,18 +5,28 @@ on: - published push: tags: - - 'v[0-9]+.[0-9]+.[0-9]+-[abcehlprt]+.?[0-9]?[0-9]?' + - '[0-9]+.[0-9]+.[0-9]+' jobs: push_to_registry: name: Publish Docker Image runs-on: ubuntu-latest steps: - - name: Check out the repo - uses: actions/checkout@v2 - - name: Push to Docker Hub - uses: docker/build-push-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - repository: tfgco/pusher - tag_with_ref: true + - name: Get Timestamp + id: get_timestamp + run: | + echo "ISO_TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + - name: Build and Push to Docker Hub + uses: docker/build-push-action@v3 + with: + push: true + tags: tfgco/pusher:${{ github.ref_name }} + labels: | + org.opencontainers.image.created=${{ steps.get_timestamp.outputs.ISO_TIMESTAMP }} + org.label-schema.build-date=${{ steps.get_timestamp.outputs.ISO_TIMESTAMP }}