bump version during release
This commit is contained in:
parent
9b66123bb2
commit
0eb980a067
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
@ -19,6 +19,11 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
@ -27,6 +32,11 @@ jobs:
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Run update version
|
||||
run: node update-version.js
|
||||
env:
|
||||
VERSION: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Embed version info
|
||||
run: echo "${{ github.sha }}" > ConfusedPolarBear.Plugin.IntroSkipper/Configuration/version.txt
|
||||
|
||||
@ -77,11 +87,6 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Run validation and update script
|
||||
run: node validate-and-update-manifest.js
|
||||
env:
|
||||
@ -92,6 +97,6 @@ jobs:
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add manifest.json
|
||||
git add manifest.json ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj
|
||||
git commit -m "release v${{ github.event.inputs.version }}"
|
||||
git push
|
||||
|
22
update-version.js
Normal file
22
update-version.js
Normal file
@ -0,0 +1,22 @@
|
||||
const fs = require('fs');
|
||||
|
||||
// Read csproj
|
||||
const csprojPath = './ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj';
|
||||
if (!fs.existsSync(csprojPath)) {
|
||||
console.error('ConfusedPolarBear.Plugin.IntroSkipper.csproj file not found');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function updateCsprojVersion() {
|
||||
const newVersion = process.env.VERSION
|
||||
const csprojContent = fs.readFileSync(csprojPath, 'utf8');
|
||||
|
||||
const updatedContent = csprojContent
|
||||
.replace(/<AssemblyVersion>.*<\/AssemblyVersion>/, `<AssemblyVersion>${newVersion}</AssemblyVersion>`)
|
||||
.replace(/<FileVersion>.*<\/FileVersion>/, `<FileVersion>${newVersion}</FileVersion>`);
|
||||
|
||||
fs.writeFileSync(csprojPath, updatedContent);
|
||||
console.log('Updated .csproj file with new version.');
|
||||
}
|
||||
|
||||
updateCsprojVersion()
|
Loading…
x
Reference in New Issue
Block a user