Version #3
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: Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to release "MAJOR.MINOR.PATCH.REVISION"' | |
required: true | |
jobs: | |
version: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Retrieve previous version from csproj | |
id: get_version | |
run: | | |
FILE=$(find . -name "*.csproj" | head -n 1) | |
VERSION=$(grep -oPm1 "(?<=<Version>)[^<]+" $FILE) | |
echo "previousVersion=$VERSION" >> $GITHUB_OUTPUT | |
- name: Set version in csproj | |
run: | | |
FILE=$(find . -name "*.csproj" | head -n 1) | |
sed -i "s/>${{ steps.get_version.outputs.previousVersion }}/>${{ github.event.inputs.version }}/" $FILE | |
- name: Create tag | |
run: | | |
git tag v${{ github.event.inputs.version }} | |
- name: Commit changes | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "chore: 📦️ v${{ github.event.inputs.version }}" | |
- name: Push changes | |
run: | | |
git push | |
git push --tags |