-
Notifications
You must be signed in to change notification settings - Fork 51
162 lines (153 loc) · 5.03 KB
/
build-nativeshims.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# Copyright 2021 Yubico AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build Yubico.NativeShims
on:
workflow_dispatch:
inputs:
push-to-dev:
description: 'Push to internal NuGet'
required: true
type: boolean
version:
description: 'Version'
required: false
default: "0.0.0-prerelease.YYYYMMDD.B"
type: string
schedule:
- cron: '0 0 * * *' # Every day at midnight
jobs:
build-windows:
name: Build Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- run: |
echo 'Running build script: Windows'
cd Yubico.NativeShims
& ./build-windows.ps1
- uses: actions/upload-artifact@v4
with:
name: win-x64
path: Yubico.NativeShims/win-x64/**
- uses: actions/upload-artifact@v4
with:
name: win-x86
path: Yubico.NativeShims/win-x86/**
- uses: actions/upload-artifact@v4
with:
name: win-arm64
path: Yubico.NativeShims/win-arm64/**
- uses: actions/upload-artifact@v4
with:
name: nuspec
path: |
Yubico.NativeShims/*.nuspec
Yubico.NativeShims/readme.md
- uses: actions/upload-artifact@v4
with:
name: msbuild
path: Yubico.NativeShims/msbuild/*
build-linux-amd64:
name: Build Linux (amd64)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- run: |
echo 'Running build script: Linux (amd64)'
cd Yubico.NativeShims
sh ./build-linux-amd64.sh
- uses: actions/upload-artifact@v4
with:
name: linux-x64
path: Yubico.NativeShims/linux-x64/*.so
build-linux-arm64:
name: Build Linux (arm64)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- run: |
echo 'Running build script: Linux (arm64)'
cd Yubico.NativeShims
sh ./build-linux-arm64.sh
- uses: actions/upload-artifact@v4
with:
name: linux-arm64
path: Yubico.NativeShims/linux-arm64/*.so
build-macos:
name: Build macOS
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- run: |
echo 'Running build script: macOS'
cd Yubico.NativeShims
sh ./build-macOS.sh
- uses: actions/upload-artifact@v4
with:
name: osx-x64
path: Yubico.NativeShims/osx-x64/**
- uses: actions/upload-artifact@v4
with:
name: osx-arm64
path: Yubico.NativeShims/osx-arm64/**
pack:
name: Package artifacts
permissions:
id-token: write
contents: read
packages: read
attestations: write
runs-on: windows-2019
needs: [build-windows, build-linux-amd64, build-linux-arm64, build-macos]
steps:
- uses: actions/download-artifact@v4
- run: |
mv nuspec/*.nuspec .
mv nuspec/readme.md .
$nuspec = [xml](gc Yubico.NativeShims.nuspec)
$repo = $nuspec.CreateElement("repository")
$repo.SetAttribute("url","https://github.com/${{ github.repository }}")
$repo.SetAttribute("type","git")
$nuspec.package.metadata.AppendChild($repo)
$nuspec.package.metadata.version = "${{ github.event.inputs.version }}"
$nuspec.Save("Yubico.NativeShims.nuspec")
cat Yubico.NativeShims.nuspec
- run: nuget pack Yubico.NativeShims.nuspec
- uses: actions/upload-artifact@v4
with:
name: Yubico.NativeShims.nupkg
path: Yubico.NativeShims.*.nupkg
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: |
Yubico.NativeShims/**/*.dll
Yubico.NativeShims/**/*.so
Yubico.NativeShims/**/*.dylib
Yubico.NativeShims.*.nupkg
publish-internal:
name: Publish to internal NuGet
runs-on: windows-2019
needs: pack
environment: Internal NuGet feed
permissions:
packages: write
if: ${{ github.event.inputs.push-to-dev == 'true' }}
steps:
- uses: actions/download-artifact@v4
with:
name: Yubico.NativeShims.nupkg
- run: |
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
dotnet nuget push Yubico.NativeShims.*.nupkg --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}