Helper that can be used to enforce tag-based versioning if a version exists, and otherwise use gitversion's calculated version.
npm run build
---
name: build
on:
push:
jobs:
calculate-version:
runs-on: ubuntu-latest
outputs:
semVer: ${{ steps.gitversion.outputs.semver }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.11.0
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion_initial
uses: gittools/actions/gitversion/execute@v0.11.0
with:
useConfigFile: true
- name: Calculate final version
id: gitversion
uses: nomonosound/gitversion-helper-action@2.9.0
with:
semver: ${{ steps.gitversion_initial.outputs.semVer }}
shortsha: ${{ steps.gitversion_initial.outputs.ShortSha }}
useTagIfExists: true
githubRef: ${{ github.ref }}
build-and-push-image:
runs-on: ubuntu-latest
needs:
- calculate-version
env:
SEMVER: ${{ needs.calculate-version.outputs.semVer }}
steps:
- run: echo "{{ env.SEMVER }}"