-
Notifications
You must be signed in to change notification settings - Fork 14
57 lines (52 loc) · 2.15 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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.inputs.version_prerelease_identifier && '' || '-' }}${{ 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%