Publish Build #186
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: Publish Build | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
inputs: | |
version_prerelease_identifier: | |
description: 'Semantic versioning prerelease identifier (after hyphen)' | |
default: '' | |
type: string | |
jobs: | |
release-and-publish: | |
env: | |
NUGET_PACKAGE_VERSION_MAJOR: 0 | |
NUGET_PACKAGE_VERSION_MINOR: 1 | |
NUGET_PACKAGE_VERSION_PATCH: ${{ github.run_number }} | |
NUGET_PACKAGE_VERSION_PRERELEASE_SUFFIX: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_prerelease_identifier != '' && format('-{0}', github.event.inputs.version_prerelease_identifier) || '' }} | |
runs-on: windows-2022 | |
name: Swift/WinRT Release Build & Publish | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: ./.github/actions/windows-build | |
env: | |
NUGET_PACKAGE_VERSION: ${{ env.NUGET_PACKAGE_VERSION_MAJOR }}.${{ env.NUGET_PACKAGE_VERSION_MINOR }}.${{ env.NUGET_PACKAGE_VERSION_PATCH }}${{ env.NUGET_PACKAGE_VERSION_PRERELEASE_SUFFIX }} | |
with: | |
config: release | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Nuget | |
shell: cmd | |
run: | | |
cmake --build --preset release --target nuget | |
- name: Publish NuGet Package | |
shell: cmd | |
env: | |
GITHUB_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
GITHUB_USERNAME: thebrowsercompany-bot2 | |
NUGET_PUBLISH_URL: https://nuget.pkg.github.com/thebrowsercompany/index.json | |
NUGET_SOURCE_NAME: TheBrowserCompany | |
run: | | |
set PATH=%PATH%;%GITHUB_WORKSPACE%\build\release | |
nuget sources list | find "%NUGET_SOURCE_NAME%" | |
if errorlevel 0 ( | |
nuget sources remove -name %NUGET_SOURCE_NAME% | |
) | |
nuget sources Add -Name %NUGET_SOURCE_NAME% -Source %NUGET_PUBLISH_URL% -username %GITHUB_USERNAME% -password %GITHUB_TOKEN% -StorePasswordInClearText | |
nuget setApiKey %GITHUB_TOKEN% -Source %NUGET_PUBLISH_URL% | |
nuget push %GITHUB_WORKSPACE%\build\release\*.nupkg -Source %NUGET_SOURCE_NAME% |