Skip to content

Allow versioning, do explicit pull before running #95

Allow versioning, do explicit pull before running

Allow versioning, do explicit pull before running #95

Workflow file for this run

name: Show git version
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
showversion:
runs-on: ubuntu-latest
steps:
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.0.2
with:
versionSpec: '5.x'
- name: Install Checkout
uses: actions/checkout@v4.2.2
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@v3.0.2
with:
additionalArguments: /config commit-date-format="yyyy-MM-ddTHH:mm:ss-0000"
- name: Alternate Git Version
id: alternategitversion
uses: codacy/git-version@2.8.0
with:
release-branch: 'main'
prefix: 'v'
- name: Direct Git Version
id: directgitversion
run: |
GITDIRECTVERSION=`git describe --tags --dirty`
echo "GITDIRECTVERSION=${GITDIRECTVERSION}" >> $GITHUB_ENV
- name: Display GitVersion outputs (step output)
run: |
GITSHA=${{ steps.gitversion.outputs.Sha }}
GITSHA8=${GITSHA:0:8}
GITCOMMITS=${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
GITPREVVERSION=${{ steps.alternategitversion.outputs.previous-version }}
GITVERSION=${GITPREVVERSION}+${GITCOMMITS}.g${GITSHA8}
GITTIME=`git show | grep Date | head -n 1 | awk '{print $5 $7}'`
GITDATE=${{ steps.gitversion.outputs.commitDate }}"T"${GITTIME}
BUILD_TIME=$(date -Iseconds)
echo "BUILD_TIME=${BUILD_TIME}" >> $GITHUB_ENV
echo "GITVERSION: ${GITVERSION}"
echo "GITDIRECTVERSION: ${{ env.GITDIRECTVERSION}}"
echo "GITSHA: ${GITSHA}"
echo "GITCOMMITS: ${GITCOMMITS}"
echo "GITSHA8: ${GITSHA8}"
echo "GITDATE: ${GITDATE}"