Skip to content

Update README.md

Update README.md #21

name: Build and Publish latest Docker Image
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: get env variables for GIT related info
run: |
echo "GIT_REVISION=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
echo "GIT_BRANCH=$(echo $GITHUB_REF | sed 's/refs\/heads\///')" >> $GITHUB_ENV
echo "GIT_REMOTE=$(git config --get remote.origin.url)" >> $GITHUB_ENV
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: c2dhunilu/ww2:latest
build-args: |
GIT_REVISION=${{ env.GIT_REVISION }}
BUILD_DATE=${{ env.BUILD_DATE }}
GIT_BRANCH=${{ env.GIT_BRANCH }}
GIT_REMOTE=${{ env.GIT_REMOTE }}
GIT_TAG=${{ env.GIT_TAG }}