Repository navigation
121 lines (105 loc) · 4.37 KB
/
Copy pathbuild.yml
File metadata and controls
121 lines (105 loc) · 4.37 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# PR / main: linux-x64 Payload + pack pointer + gh.linux-x64. Full RID matrix is publish.yml.
name: build
on:
workflow_dispatch:
inputs:
configuration:
type: choice
description: Configuration
options:
- Release
- Debug
push:
branches: [ main, 'feature/*', 'rel/*' ]
paths-ignore:
- changelog.md
- readme.md
pull_request:
types: [opened, synchronize, reopened]
env:
DOTNET_NOLOGO: true
PackOnBuild: true
GeneratePackageOnBuild: false
VersionPrefix: 42.42.${{ github.run_number }}
VersionLabel: ${{ github.ref }}
GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
MSBUILDTERMINALLOGGER: auto
Configuration: ${{ github.event.inputs.configuration || 'Release' }}
SLEET_FEED_URL: ${{ vars.SLEET_FEED_URL }}
defaults:
run:
shell: pwsh
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
- name: 📦 gh.cli
run: |
$ErrorActionPreference = 'Stop'
dotnet pack src/GitHub.Cli/GitHub.Cli.csproj -c $env:Configuration -p:GeneratePackageOnBuild=false -bl:pointer-pack.binlog
if ($LASTEXITCODE -ne 0) { throw "gh.cli pointer pack failed with exit code $LASTEXITCODE." }
dotnet pack src/GitHub.Cli/GitHub.Cli.csproj -c $env:Configuration -r linux-x64 -p:GeneratePackageOnBuild=false -bl:pack-linux-x64.binlog
if ($LASTEXITCODE -ne 0) { throw "gh.cli linux-x64 pack failed with exit code $LASTEXITCODE." }
- name: 🙏 build
run: dotnet build -m:1 -bl:build.binlog
- name: 🧪 test
run: dnx --yes retest -- --no-build
- name: 📦 gh
run: |
$ErrorActionPreference = 'Stop'
dotnet pack src/gh/gh.csproj -c $env:Configuration -p:GeneratePackageOnBuild=false -bl:pointer-pack-gh.binlog
if ($LASTEXITCODE -ne 0) { throw "gh pointer pack failed with exit code $LASTEXITCODE." }
dotnet pack src/gh/gh.csproj -c $env:Configuration -r linux-x64 -p:GeneratePackageOnBuild=false -bl:pack-gh-linux-x64.binlog
if ($LASTEXITCODE -ne 0) { throw "gh linux-x64 pack failed with exit code $LASTEXITCODE." }
- name: ✅ unix execute bits
run: |
$ErrorActionPreference = 'Stop'
$script = Join-Path $pwd 'src/GitHub.Cli/unix-exec.ps1'
$cli = Get-ChildItem bin -Filter "gh.cli.linux-x64.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
$tool = Get-ChildItem bin -Filter "gh.linux-x64.*.nupkg" | Where-Object Name -notlike '*.symbols.*' | Select-Object -First 1
if (-not $cli) { throw "gh.cli.linux-x64 nupkg not found" }
if (-not $tool) { throw "gh.linux-x64 nupkg not found" }
foreach ($pkg in @($cli, $tool)) {
& pwsh -NoProfile -File $script -Nupkg $pkg.FullName -Assert
if ($LASTEXITCODE -ne 0) { throw "unix execute bits missing in $($pkg.Name)" }
}
- name: 📤 package
uses: actions/upload-artifact@v4
with:
name: package-linux-x64
path: bin/*.nupkg
retention-days: 7
if-no-files-found: error
- name: 🐛 logs
uses: actions/upload-artifact@v4
if: runner.debug && always()
with:
name: logs
path: '*.binlog'
- name: 🚀 sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
if: env.SLEET_CONNECTION != ''
shell: bash
run: |
dotnet tool update sleet -g --allow-downgrade --version $(curl -s --compressed ${{ vars.SLEET_FEED_URL }} | jq '.["sleet:version"]' -r)
sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found"
dotnet-format:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
- name: ✓ ensure format
run: |
dotnet format whitespace --verify-no-changes --no-restore -v:diag --exclude ~/.nuget
dotnet format style --verify-no-changes --no-restore -v:diag --exclude ~/.nuget