CI Pipeline #34
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Pipeline | |
on: | |
pull_request: | |
branches: | |
- main | |
- release/* | |
push: | |
branches: | |
- main | |
- release/* | |
create: | |
branches-ignore: | |
- release/* | |
workflow_dispatch: | |
jobs: | |
setup: | |
name: setup | |
runs-on: ubuntu-latest | |
env: | |
GitToolVersion: 6.0.3 | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history to get full git version details | |
# Install GitVersion tool | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: ${{ env.GitToolVersion }} | |
includePrerelease: true | |
# Run GitVersion | |
- name: Execute GitVersion | |
id: gitversion # GitHub Actions ID for future reference | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
useConfigFile: true | |
configFilePath: "GitVersion.yml" | |
# Set the build number based on GitVersion and PR number | |
- name: Set Build Number | |
if: github.event_name == 'pull_request' | |
run: | | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
VERSION="${{ steps.gitversion.outputs.semver }}" | |
echo "Build number: $VERSION" | |
echo "GITHUB_RUN_NUMBER=$VERSION" >> $GITHUB_ENV | |
# Set the build number based on GitVersion (release|main) | |
- name: Set Build Number for Main|Release | |
if: github.event_name != 'pull_request' | |
run: | | |
VERSION="${{ steps.gitversion.outputs.semver }}" | |
echo "Build number: $VERSION" | |
echo "GITHUB_RUN_NUMBER=$VERSION" >> $GITHUB_ENV | |
# Set GitVersion variables for later use | |
- name: Set GitVersion variables | |
run: | | |
echo "SemVer=${{ steps.gitversion.outputs.semver }}" >> $GITHUB_ENV | |
echo "MajorMinorPatch=${{ steps.gitversion.outputs.majorminorpatch }}" >> $GITHUB_ENV | |
# Tag the repository (only for main or release branches, not pull requests) | |
- name: Tag repo | |
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git tag ${{ steps.gitversion.outputs.semver }} | |
git push https://${GITHUB_TOKEN}@github.com/${{ github.repository }} ${{ steps.gitversion.outputs.semver }} |