fix: updated build script

This commit is contained in:
Nick Genovese
2024-12-06 12:32:20 -05:00
parent 322fc4eac6
commit deb14c63e5
3 changed files with 42 additions and 172 deletions

View File

@@ -24,29 +24,50 @@ jobs:
env:
GITHUB_REF: ${{ github.ref }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Install dependencies
run: "npm install -g
semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator
@semantic-release/changelog @semantic-release/exec conventional-changelog-conventionalcommits"
- name: Run semantic-release
- name: Set Version Number and Phase
id: get_version
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print summary if no new version
if: steps.get_version.outputs.newVersion != 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN}}
run: |
echo "# Summary" >> $GITHUB_STEP_SUMMARY
echo "No new version generated" >> $GITHUB_STEP_SUMMARY
# Set initial version
latestVersion="2.0.0"
newVersion="$latestVersion"
phase=""
newVersionString=""
# Output current GitHub Ref
echo "Current GitHub Ref: $GITHUB_REF"
# Determine the phase and version string based on the branch
case $GITHUB_REF in
refs/pull/*)
phase="beta"
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
;;
refs/heads/hotfix-2.0.0/*)
phase="hotfix"
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
;;
refs/heads/release-2.0.0/*)
splitRef=(${GITHUB_REF//\// })
version="${splitRef[-1]//v/}"
phase="rc"
newVersionString="${version}-${phase}-${GITHUB_RUN_NUMBER}"
;;
refs/heads/feature-2.0.0/*)
phase="alpha"
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
;;
development-2.0.0)
phase="beta"
newVersionString="${newVersion}-${phase}-${GITHUB_RUN_NUMBER}"
;;
esac
# Output the final determined version and build phase
echo "Version to be used: $newVersionString"
echo "Build Phase: $phase"
# Write the version to the GitHub environment file
echo "version=$newVersionString" >> $GITHUB_ENV
- name: Set up .NET
uses: actions/setup-dotnet@v3