Skip to content

Auto-update version

Auto-update version #4

Workflow file for this run

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@v3
- 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: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: Auto-update version to ${{ steps.date.outputs.MonthName }} ${{ steps.date.outputs.Year }}
body:
commit-message: Auto-update version
branch: autoupdate-version
delete-branch: true
reviewers: idzm