Auto-update version #11
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: Auto-update version | |
on: | |
schedule: | |
- cron: '43 4 1 * *' | |
workflow_dispatch: | |
env: | |
AssemblyInfoPath: ./src/Properties/AssemblyInfo.cs | |
jobs: | |
autoversion: | |
name: Auto-update version | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.BOT_ACCESS_TO_EPLAN }} | |
- id: date | |
run: | | |
echo "Month=$(date +'%m')" >> $env:GITHUB_OUTPUT | |
echo "Year=$(date +'%Y')" >> $env:GITHUB_OUTPUT | |
echo "MonthName=$(date +'%B')" >> $env:GITHUB_OUTPUT | |
- name: Change version | |
run: > | |
(Get-Content ${{ env.AssemblyInfoPath }}) | |
-replace '(?<start>(AssemblyVersion|AssemblyFileVersion)\(\")\d{4}\.\d{2}', | |
"`${start}${{ steps.date.outputs.Year }}.${{ steps.date.outputs.Month }}" | |
-replace '(?<start>Copyright © 2012 - )\d{4}', | |
"`${start}${{ steps.date.outputs.Year }}" | |
| Set-Content ${{ env.AssemblyInfoPath }} | |
- name: Commit update | |
run: | | |
git config --global user.name 'Git bot' | |
git config --global user.email '[email protected]' | |
git commit -am "[config] Auto-update version to ${{ steps.date.outputs.MonthName }} ${{ steps.date.outputs.Year }}" && git push || echo "No changes to commit" |