Skip to content

Commit a607edc

Browse files
authored
ci: upload precompiled binaries to releases (#37)
1 parent 5393736 commit a607edc

3 files changed

Lines changed: 76 additions & 103 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
name: Component Detection PR
1+
name: Build
22

3-
on: [pull_request]
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
49

510
jobs:
611
build:
7-
812
runs-on: ubuntu-latest
913

1014
env:
@@ -13,20 +17,21 @@ jobs:
1317
MINVERBUILDMETADATA: build.${{github.run_number}}
1418

1519
steps:
16-
- uses: actions/checkout@v2.3.2
17-
with:
18-
fetch-depth: 0
20+
- name: Checkout repository
21+
uses: actions/checkout@v2.3.2
22+
with:
23+
fetch-depth: 0
1924

20-
- name: Setup .NET Core
21-
uses: actions/setup-dotnet@v1
22-
with:
23-
dotnet-version: 3.1.x
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v1
27+
with:
28+
dotnet-version: 3.1.x
2429

25-
- name: dotnet restore
26-
run: dotnet restore
30+
- name: Restore packages
31+
run: dotnet restore
2732

28-
- name: Build and publish
29-
run: dotnet publish -o dist --no-self-contained -c Release ./src/Microsoft.ComponentDetection
33+
- name: Build
34+
run: dotnet build --no-restore --configuration Debug
3035

31-
- name: Run tests
32-
run: dotnet test
36+
- name: Run tests
37+
run: dotnet test --no-build --configuration Debug

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
rid: [win-x64, linux-x64, osx-x64]
18+
19+
env:
20+
OFFICIAL_BUILD: 'True'
21+
# Set the build number in MinVer.
22+
MINVERBUILDMETADATA: build.${{github.run_number}}
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v2.4.0
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v1.9.0
32+
with:
33+
dotnet-version: 3.1.x
34+
35+
- name: Restore packages
36+
run: dotnet restore
37+
38+
- name: Build CLI tool
39+
run: dotnet publish --configuration Release --output ./bin --self-contained --runtime ${{ matrix.rid }} -p:PublishSingleFile=true -p:DebugType=None -p:PublishTrimmed=true ./src/Microsoft.ComponentDetection
40+
41+
- name: Publish CLI tool
42+
uses: shogo82148/actions-upload-release-asset@v1.4.0
43+
with:
44+
upload_url: ${{ github.event.release.upload_url }}
45+
asset_path: ./bin/*
46+
asset_name: component-detection-${{ matrix.rid }}${{ matrix.rid == 'win-x64' && '.exe' || '' }}
47+
48+
- name: Build NuGet packages
49+
run: dotnet pack --configuration Release --output ./out
50+
51+
- name: Publish NuGet packages to GitHub Packages
52+
run: dotnet nuget push ./out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}
53+
54+
- name: Publish NuGet packages to Azure Artifacts
55+
run: dotnet nuget push ./out/*.nupkg --skip-duplicate --api-key ${{ secrets.AZART_TOKEN }} --source https://1essharedassets.pkgs.visualstudio.com/1esPkgs/_packaging/ComponentDetection/nuget/v3/index.json

0 commit comments

Comments
 (0)