#TIL 29 - Git version

Jul 25, 2022 · Dung Huynh

What

Auto-generate semantic version from git commits in GitHub Actions.

Why

Automate versioning based on commit history and tags.

How

name: Git Version
on:
  push:
    branches: [main, release]

jobs:
  version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - uses: codacy/git-version@2.5.4
        id: version

      - run: echo "${{ steps.version.outputs.version }}"