bump version during release
This commit is contained in:
parent
87a5148610
commit
766ba2daa0
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
@ -19,6 +19,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
@ -27,6 +32,11 @@ jobs:
|
|||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
run: dotnet restore
|
run: dotnet restore
|
||||||
|
|
||||||
|
- name: Run update version
|
||||||
|
run: node update-version.js
|
||||||
|
env:
|
||||||
|
VERSION: ${{ github.event.inputs.version }}
|
||||||
|
|
||||||
- name: Embed version info
|
- name: Embed version info
|
||||||
run: echo "${{ github.sha }}" > ConfusedPolarBear.Plugin.IntroSkipper/Configuration/version.txt
|
run: echo "${{ github.sha }}" > ConfusedPolarBear.Plugin.IntroSkipper/Configuration/version.txt
|
||||||
|
|
||||||
@ -77,11 +87,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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
|
- name: Run validation and update script
|
||||||
run: node validate-and-update-manifest.js
|
run: node validate-and-update-manifest.js
|
||||||
env:
|
env:
|
||||||
@ -92,6 +97,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
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 commit -m "release v${{ github.event.inputs.version }}"
|
||||||
git push
|
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