Files
PepperDashCore/.github/workflows/docker.yml
2023-02-03 16:51:20 -07:00

74 lines
2.9 KiB
YAML

name: Branch Build Using Docker
on:
push:
branches:
- feature/*
- hotfix/*
- release/*
- development
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: Pepperdash Core
SOLUTION_FILE: PepperDash Core 4-series
# 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
# Fetch all tags
- name: Fetch tags
run: git fetch --tags
# Generate the appropriate version number
- name: Set Version Number
id: setVersion
shell: pwsh
run: |
$version = ./.github/scripts/GenerateVersionNumber.ps1
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Setup MS Build
uses: microsoft/setup-msbuild@v1.1
- name: restore Nuget Packages
run: nuget restore ./$($Env:SOLUTION_PATH)/$($Env:SOLUTION_FILE)
env:
SOLUTION_FILE: PepperDash Core 4-Series.sln
# Build the solutions in the docker image
- name: Build Solution
shell: powershell
run: |
msbuild "./$($Env:SOLUTION_PATH)/$($Env:SOLUTION_FILE) 4-Series.sln" -p:Platform="Any CPU" -p:Configuration="Debug -p:VersionPrefix=$(steps.setVersion.outputs.version)"
- name: Create tag for non-rc builds
if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta')
run: |
git tag $($Env: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-')
uses: actions/create-release@v1
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
prerelease: ${{contains('debug', env.BUILD_TYPE)}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload the build package to the release
- name: Add Github Packages source
run: nuget sources add -name github -source https://nuget.pkg.github.com/pepperdash/index.json -username Pepperdash -password ${{ secrets.GITHUB_TOKEN }}
- name: Add nuget.org API Key
run: nuget setApiKey ${{ secrets.NUGET_API_KEY }}
- name: Create nuget package
run: nuget pack "./Pepperdash Core/Pepperdash Core/PepperDash_Core_4-Series.csproj.nuspec" -version ${{ env.VERSION }}
- name: Publish nuget package to Github registry
run: nuget push "./*.nupkg" -Source github
- name: Publish nuget package to nuget.org
run: nuget push "./*.nupkg" -Source https://api.nuget.org/v3/index.json