-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
101 additions
and
53 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# build-windows.yml | ||
# Reusable workflow that builds the Windows versions of Libation. | ||
--- | ||
name: build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version_override: | ||
type: string | ||
description: 'Version number override' | ||
required: false | ||
project_file: | ||
type: string | ||
description: 'Path to the .csproj file' | ||
required: true | ||
nuspec_file: | ||
type: string | ||
description: 'Path to the .nuspec file' | ||
required: true | ||
secrets: | ||
nuget_token: | ||
description: 'Nuget Api authentication token' | ||
required: false | ||
|
||
env: | ||
DOTNET_CONFIGURATION: 'Release' | ||
DOTNET_VERSION: '6.0.x' | ||
NUGET_SOURCE: 'https://api.nuget.org/v3/index.json' | ||
|
||
jobs: | ||
build: | ||
name: Build and Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
env: | ||
NUGET_AUTH_TOKEN: ${{ secrets.nuget_token }} | ||
|
||
- name: Get version | ||
id: get_version | ||
working-directory: | ||
run: | | ||
inputVersion="${{ inputs.version_override }}" | ||
if [[ "${#inputVersion}" -gt 0 ]] | ||
then | ||
version="${inputVersion}" | ||
else | ||
version="$(grep -Eio -m 1 '<Version>.*</Version>' ${{ inputs.project_file }} | sed -r 's/<\/?Version>//g')" | ||
fi | ||
echo "version=${version}" >> "${GITHUB_OUTPUT}" | ||
- name: Build and Pack | ||
id: build_pack | ||
run: | | ||
nuspec_relative=$(realpath --relative-to="$(dirname ${{ inputs.project_file }})" "${{ inputs.nuspec_file }}") | ||
dotnet build ${{ inputs.project_file }} -c ${{ env.DOTNET_CONFIGURATION }} | ||
dotnet pack ${{ inputs.project_file }} --no-build -c ${{ env.DOTNET_CONFIGURATION }} -o . -p:NuspecFile="$nuspec_relative" -p:NuspecProperties="version=${{ steps.get_version.outputs.version }}" | ||
nupkg=$(ls *.nupkg) | ||
echo "nupkg=${nupkg}" >> "${GITHUB_OUTPUT}" | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: '${{ steps.build_pack.outputs.nupkg }}' | ||
path: ./ | ||
if-no-files-found: error | ||
retention-days: 7 | ||
|
||
- name: Publish nupkg | ||
continue-on-error : true | ||
run: | | ||
dotnet nuget push '${{ steps.build_pack.outputs.nupkg }}' -s ${{ env.NUGET_SOURCE }} -k ${{ secrets.nuget_token }} --skip-duplicate | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,19 @@ | ||
name: publish to nuget | ||
# validate.yml | ||
# Validates that Libation will build on a pull request or push to master. | ||
--- | ||
name: validate | ||
|
||
on: | ||
push: | ||
branches: | ||
- master # Default release branch | ||
jobs: | ||
publish: | ||
name: build, pack & publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 6.0.x | ||
# Publish | ||
- name: publish on version change | ||
id: publish_nuget | ||
uses: Mbucari/publish-nuget@master | ||
with: | ||
# Filepath of the project to be packaged, relative to root of repository | ||
PROJECT_FILE_PATH: src/AAXClean/AAXClean.csproj | ||
|
||
# NuGet package id, used for version detection & defaults to project name | ||
PACKAGE_NAME: AAXClean | ||
|
||
BUILD_PLATFORM: AnyCPU | ||
BUILD_CONFIGURATION: Release | ||
NUSPEC_FILE: ../../AAXClean.nuspec | ||
|
||
# Filepath with version info, relative to root of repository & defaults to PROJECT_FILE_PATH | ||
# VERSION_FILE_PATH: Directory.Build.props | ||
|
||
# Regex pattern to extract version info in a capturing group | ||
VERSION_REGEX: ^\s*<Version>(.*)<\/Version>\s*$ | ||
|
||
# Useful with external providers like Nerdbank.GitVersioning, ignores VERSION_FILE_PATH & VERSION_REGEX | ||
# VERSION_STATIC: 1.0.0 | ||
|
||
# Flag to toggle git tagging, enabled by default | ||
# TAG_COMMIT: true | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
# Format of the git tag, [*] gets replaced with actual version | ||
# TAG_FORMAT: v* | ||
|
||
# API key to authenticate with NuGet server | ||
NUGET_KEY: ${{secrets.AAXClean_NUGET_API_KEY}} | ||
|
||
# NuGet server uri hosting the packages, defaults to https://api.nuget.org | ||
# NUGET_SOURCE: https://api.nuget.org | ||
|
||
# Flag to toggle pushing symbols along with nuget package to the server, disabled by default | ||
INCLUDE_SYMBOLS: false | ||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
project_file: ./src/AAXClean/AAXClean.csproj | ||
nuspec_file: ./AAXClean.nuspec | ||
secrets: | ||
nuget_token: ${{ secrets.AAXCLEAN_NUGET_API_KEY }} |
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