added date to tag #10
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
#name: Docker Image CI | |
# | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# GitHub recommends pinning actions to a commit SHA. | |
# To get a newer version, you will need to update the SHA. | |
# You can also reference a tag or branch, but the action may change without warning. | |
name: Publish Docker image | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
name: Build and Push | |
runs-on: ubuntu-latest | |
steps: | |
- steps: | |
- name: Set current date as env variable | |
run: echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV | |
- name: Echo current date | |
run: echo $NOW | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Harbor | |
uses: docker/login-action@v2 | |
with: | |
registry: https://${{ secrets.HARBOR_REGISTRY_URL }} | |
username: ${{ secrets.HARBOR_REGISTRY_USERNAME }} | |
password: ${{ secrets.HARBOR_REGISTRY_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ secrets.HARBOR_REGISTRY_URL }}/baeda/timeseries-inspector:$NOW | |
#on: | |
# push: | |
# branches: [ "main" ] | |
# pull_request: | |
# branches: [ "main" ] | |
# | |
#jobs: | |
# | |
# build: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Build the Docker image | |
# run: docker build -t harbor.crownlabs.polito.it/baeda/timeseries-inspector:$(date +%s).v1 . | |
# |