Skip to content

Update showversion.yml #716

Update showversion.yml

Update showversion.yml #716

name: Upload latest to DockerHub
on:
workflow_dispatch:
push:
branches: [ main, dockermods, dev ]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Install Checkout
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }} # checkout the correct branch name
fetch-depth: 0
- name: Determine Version
id: gitversion # id to later be referenced
uses: gittools/actions/gitversion/execute@v0
with:
config: config commit-date-format="yyyy-MM-ddTHH:mm:ssZ"
- name: Display GitVersion outputs (step output)
run: |
GITVERSION=${{ steps.gitversion.outputs.fullSemVer }}.${{ steps.gitversion.outputs.shortSha }}
GITSHA=${{ steps.gitversion.outputs.Sha }}
GITTIME=`git show | grep Date | head -n 1 | awk '{print $5 $7}'`
#GITDATE=${{ steps.gitversion.outputs.commitDate }}"T"${GITTIME}
GITDATE=${{ steps.gitversion.outputs.commitDate }}
echo "GITVERSION=${GITVERSION}" >> $GITHUB_ENV
echo "GITSHA=${GITSHA}" >> $GITHUB_ENV
echo "GITDATE=${GITDATE}" >> $GITHUB_ENV
BUILD_TIME=$(date -Iseconds)
echo "BUILD_TIME=${BUILD_TIME}" >> $GITHUB_ENV
- name: What
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: fredericklab/rapidtide
- name: Free disk space
run: |
df -h
sudo rm -rf ${GITHUB_WORKSPACE}/.git
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
sbom: false
provenance: false
tags: fredericklab/rapidtide:latest
build-args: |
BRANCH=${{ env.BRANCH }}
GITVERSION=${{ env.GITVERSION }}
GITSHA=${{ env.GITSHA }}
GITDATE=${{ env.GITDATE }}
BUILD_TIME=${{ env.BUILD_TIME }}