Skip to content

Append COMMIT_SHORT_SHA to container image tag #17

Append COMMIT_SHORT_SHA to container image tag

Append COMMIT_SHORT_SHA to container image tag #17

Workflow file for this run

name: Build Docker Image
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: "${{ secrets.DOCKER_HUB_USERNAME }}"
password: "${{ secrets.DOCKER_HUB_TOKEN }}"
- name: Set Short Git Commit SHA
id: vars
run: |
SHORT_SHA=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$SHORT_SHA" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: true
tags: "${{ secrets.DOCKER_HUB_USERNAME }}/telegraf:1.31.3-${{ env.COMMIT_SHORT_SHA }}"