-
-
Notifications
You must be signed in to change notification settings - Fork 259
103 lines (94 loc) · 3.27 KB
/
ci.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: CI
on:
push:
branches-ignore:
- dependabot/*
pull_request:
workflow_dispatch:
inputs:
is_stable_build:
description: Use a version number indicating this is a stable release
required: true
default: "false"
release:
description: Create a release
required: true
default: "false"
branches:
- main
- release/*
env:
IS_STABLE_BUILD: ${{ github.event.inputs.is_stable_build }}
jobs:
build:
if: "!contains(github.event.head_commit.message, 'ci skip') || github.event_name == 'workflow_dispatch'"
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
outputs:
package_version: ${{ steps.build_script.outputs.package_version }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Run build script
id: build_script
run: ./build.ps1 -ci
- uses: actions/upload-artifact@v2
if: ${{ matrix.os == 'windows-latest' }}
with:
name: packages
path: artifacts/
if-no-files-found: error
- uses: codecov/codecov-action@v3
with:
name: unittests-${{ matrix.os }}
fail_ci_if_error: true
release:
if: "github.event.inputs.release"
needs: build
runs-on: windows-latest
env:
PACKAGE_VERSION: ${{ needs.build.outputs.package_version }}
steps:
- run: echo "Releasing ${{ env.PACKAGE_VERSION }}"
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
with:
nuget-version: latest
- uses: actions/download-artifact@v2
with:
name: packages
path: packages
- name: Configure GitHub NuGet registry
run: nuget sources add -name github -source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -username ${{ github.repository_owner }} -password ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub package registry
run: nuget push packages\*.nupkg -ApiKey ${{ secrets.GITHUB_TOKEN }} -Source github -SkipDuplicate
- name: Push to NuGet.org
run: nuget push packages\*.nupkg -ApiKey ${{ secrets.NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json
- name: Create GitHub release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ env.PACKAGE_VERSION }}
tag_name: v${{ env.PACKAGE_VERSION }}
body: |
## How to get this update
Packages have been posted to these feeds:
#### NuGet.org
https://nuget.org/packages/McMaster.Extensions.CommandLineUtils/${{ env.PACKAGE_VERSION }}
https://nuget.org/packages/McMaster.Extensions.Hosting.CommandLine/${{ env.PACKAGE_VERSION }}
#### GitHub Package Registry
https://github.com/natemcmaster?tab=packages&repo_name=CommandLineUtils
draft: false
append_body: true
generate_release_notes: true
prerelease: ${{ env.IS_STABLE_BUILD == 'false' }} # Example: v3.1.0-beta
files: packages/*