Auto Version #21
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 Version | |
on: | |
workflow_dispatch: | |
permissions: | |
actions: write | |
contents: write | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: develop | |
token: ${{ secrets.PAT }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21.x | |
- name: Install NPM Packages | |
run: npm ci | |
working-directory: . | |
- name: Create Changeset | |
run: | | |
npx changeset add --empty | |
echo --- > .changeset/empty.md | |
echo "appversioning": patch >> .changeset/empty.md | |
echo --- >> .changeset/empty.md | |
echo "" >> .changeset/empty.md | |
echo Updating patch >> .changeset/empty.md | |
working-directory: . | |
- name: Bump Version | |
run: npm run update-version | |
working-directory: . | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit Changelog Files | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git add -A | |
# git add ./AppVersioning/CHANGELOG.md | |
# git add ./AppVersioning/.changeset | |
# git add ./AppVersioning/package.json | |
git diff --quiet || git commit -m "Update changelog" | |
git push origin develop | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sync Changesets Version | |
shell: pwsh | |
run: | | |
$package = Get-Content -Raw ./package.json | ConvertFrom-Json | |
$version = $package.version | |
$xml = [Xml] (Get-Content ./AppVersioning.csproj) | |
$xml.Project.PropertyGroup.ApplicationDisplayVersion = $version | |
$xml.Save("./AppVersioning.csproj") | |
- name: Commit & Push Version Bump | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git add ./AppVersioning.csproj | |
git commit -m "Bump version" | |
git push origin develop | |
- name: Develop -> Master | |
run: | | |
git fetch origin master | |
git checkout -b master origin/master | |
git merge develop && git push origin master |