Skip to content

Publish Build

Publish Build #265

Workflow file for this run

name: Publish Build
on:
push:
branches: [ "main" ]
# This is a low-traffic but critical repo, so we want to catch build regressions due to GitHub updates early, and at least be able to bisect
schedule:
- cron: '0 0 * * 0' # Every Sunday at midnight (GitHub runners are updated weekly)
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
if: github.event_name != 'schedule'
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%