mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 20:24:57 +00:00
fix: updated build script
This commit is contained in:
63
.github/workflows/build.yml
vendored
63
.github/workflows/build.yml
vendored
@@ -24,29 +24,50 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_REF: ${{ github.ref }}
|
GITHUB_REF: ${{ github.ref }}
|
||||||
|
|
||||||
- name: Set up Node.js
|
- name: Set Version Number and Phase
|
||||||
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
|
|
||||||
id: get_version
|
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: |
|
run: |
|
||||||
echo "# Summary" >> $GITHUB_STEP_SUMMARY
|
# Set initial version
|
||||||
echo "No new version generated" >> $GITHUB_STEP_SUMMARY
|
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
|
- name: Set up .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
|
|||||||
97
.github/workflows/docker.yml
vendored
97
.github/workflows/docker.yml
vendored
@@ -1,97 +0,0 @@
|
|||||||
name: Branch Build Using Docker
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
env:
|
|
||||||
# solution path doesn't need slashes unless there it is multiple folders deep
|
|
||||||
# solution name does not include extension. .sln is assumed
|
|
||||||
SOLUTION_PATH: .
|
|
||||||
SOLUTION_FILE: PepperDash.Essentials
|
|
||||||
# Do not edit this, we're just creating it here
|
|
||||||
VERSION: 0.0.0-buildtype-buildnumber
|
|
||||||
# Defaults to debug for build type
|
|
||||||
BUILD_TYPE: Debug
|
|
||||||
# Defaults to main as the release branch. Change as necessary
|
|
||||||
RELEASE_BRANCH: main
|
|
||||||
jobs:
|
|
||||||
Build_Project_4-Series:
|
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Set Version Number
|
|
||||||
id: setVersion
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
$latestVersion = [version]"2.0.0"
|
|
||||||
|
|
||||||
$newVersion = [version]$latestVersion
|
|
||||||
$phase = ""
|
|
||||||
$newVersionString = ""
|
|
||||||
|
|
||||||
Write-Host "Current GitHub Ref: $Env:GITHUB_REF"
|
|
||||||
|
|
||||||
switch -regex ($Env:GITHUB_REF) {
|
|
||||||
'^refs\/pull\/*.' {
|
|
||||||
$phase = 'beta';
|
|
||||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
'^refs\/heads\/hotfix-2.0.0\/*.' {
|
|
||||||
$phase = 'hotfix'
|
|
||||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
'^refs\/heads\/release-2.0.0\/*.' {
|
|
||||||
$splitRef = $Env:GITHUB_REF -split "/"
|
|
||||||
$version = [version]($splitRef[-1] -replace "v", "")
|
|
||||||
$phase = 'rc'
|
|
||||||
$newVersionString = "{0}-{1}-{2}" -f $version, $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
'^refs\/heads\/feature-2.0.0\/*.' {
|
|
||||||
$phase = 'alpha'
|
|
||||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
'development-2.0.0' {
|
|
||||||
$phase = 'beta'
|
|
||||||
$newVersionString = "{0}-{1}-{2}" -f $newVersion, $phase, $Env:GITHUB_RUN_NUMBER
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Version to be used: $newVersionString"
|
|
||||||
Write-Host "Build Phase: $phase"
|
|
||||||
|
|
||||||
echo "version=$newVersionString" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
|
||||||
- name: Setup MS Build
|
|
||||||
uses: microsoft/setup-msbuild@v1.1
|
|
||||||
- name: restore Nuget Packages
|
|
||||||
run: nuget restore .\$($Env:SOLUTION_FILE).sln
|
|
||||||
# Build the solutions in the docker image
|
|
||||||
- name: Build Solution
|
|
||||||
run: msbuild .\$($Env:SOLUTION_FILE).sln /p:Platform="Any CPU" /p:Configuration="Debug" /p:Version="${{ steps.setVersion.outputs.version }}" -m
|
|
||||||
- name: Pack Solution
|
|
||||||
run: dotnet pack .\$($Env:SOLUTION_FILE).sln --configuration $env:BUILD_TYPE --output ./output /p:Version="${{ steps.setVersion.outputs.version }}"
|
|
||||||
- name: Create tag for non-rc builds
|
|
||||||
if: contains(steps.setVersion.outputs.version, 'alpha')
|
|
||||||
run: |
|
|
||||||
git tag ${{ steps.setVersion.outputs.version }}
|
|
||||||
git push --tags origin
|
|
||||||
# Create the release on the source repo
|
|
||||||
- name: Create Release
|
|
||||||
id: create_release
|
|
||||||
# if: contains(steps.setVersion.outputs.version,'-rc-') ||
|
|
||||||
# contains(steps.setVersion.outputs.version,'-hotfix-') ||
|
|
||||||
# contains(steps.setVersion.outputs.version, '-beta-')
|
|
||||||
uses: ncipollo/release-action@v1
|
|
||||||
with:
|
|
||||||
artifacts: 'output\**\*.*(cpz|cplz)'
|
|
||||||
generateReleaseNotes: true
|
|
||||||
prerelease: ${{contains('debug', env.BUILD_TYPE)}}
|
|
||||||
tag: ${{ steps.setVersion.outputs.version }}
|
|
||||||
- name: Setup Nuget
|
|
||||||
run: |
|
|
||||||
nuget sources add -name github -source https://nuget.pkg.github.com/pepperdash/index.json -username pepperdash -password ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
nuget setApiKey ${{ secrets.GITHUB_TOKEN }} -Source github
|
|
||||||
nuget setApiKey ${{ secrets.NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json
|
|
||||||
- name: Publish to Nuget
|
|
||||||
run: nuget push .\output\*.nupkg -Source https://api.nuget.org/v3/index.json
|
|
||||||
- name: Publish to Github Nuget
|
|
||||||
run: nuget push .\output\*.nupkg -Source github
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
{
|
|
||||||
"branches": [
|
|
||||||
{
|
|
||||||
"name": "development-2.0.0",
|
|
||||||
"prerelease": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "feature-2.0.0/*",
|
|
||||||
"prerelease": "beta"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "hotfix-2.0.0/*",
|
|
||||||
"prerelease": "patch"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "release-2.0.0/*",
|
|
||||||
"prerelease": "rc"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"@semantic-release/commit-analyzer",
|
|
||||||
[
|
|
||||||
"@semantic-release/release-notes-generator",
|
|
||||||
{
|
|
||||||
"preset": "conventionalcommits",
|
|
||||||
"presetConfig": {
|
|
||||||
"types": [
|
|
||||||
{ "type": "feat", "section": "🚀 Features" },
|
|
||||||
{ "type": "fix", "section": "🐛 Bug Fixes" },
|
|
||||||
{ "type": "chore", "section": "🧹 Maintenance" },
|
|
||||||
{ "type": "docs", "section": "📚 Documentation" },
|
|
||||||
{ "type": "style", "section": "💎 Code Style" },
|
|
||||||
{ "type": "refactor", "section": "🔨 Refactoring" },
|
|
||||||
{ "type": "perf", "section": "⚡ Performance Improvements" },
|
|
||||||
{ "type": "test", "section": "✅ Tests" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"@semantic-release/changelog",
|
|
||||||
{
|
|
||||||
"changelogTitle": "# 📦 Release History\n\nAll notable changes to this project will be documented in this file."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"@semantic-release/exec",
|
|
||||||
{
|
|
||||||
"verifyReleaseCmd": "echo \"newVersion=true\" >> $GITHUB_OUTPUT",
|
|
||||||
"publishCmd": "echo \"version=${nextRelease.version}\" >> $GITHUB_OUTPUT && echo \"tag=${nextRelease.gitTag}\" >> $GITHUB_OUTPUT && echo \"type=${nextRelease.type}\" >> $GITHUB_OUTPUT && echo \"channel=${nextRelease.channel}\" >> $GITHUB_OUTPUT"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user