Skip to content

Commit

Permalink
ci: upload precompiled binaries to releases (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee authored Feb 2, 2022
1 parent 5393736 commit a607edc
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 103 deletions.
87 changes: 0 additions & 87 deletions .github/workflows/build-release.yml

This file was deleted.

37 changes: 21 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: Component Detection PR
name: Build

on: [pull_request]
on:
push:
pull_request:

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

env:
Expand All @@ -13,20 +17,21 @@ jobs:
MINVERBUILDMETADATA: build.${{github.run_number}}

steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: dotnet restore
run: dotnet restore
- name: Restore packages
run: dotnet restore

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

- name: Run tests
run: dotnet test
- name: Run tests
run: dotnet test --no-build --configuration Debug
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

on:
release:
types:
- published

permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
rid: [win-x64, linux-x64, osx-x64]

env:
OFFICIAL_BUILD: 'True'
# Set the build number in MinVer.
MINVERBUILDMETADATA: build.${{github.run_number}}

steps:
- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: 3.1.x

- name: Restore packages
run: dotnet restore

- name: Build CLI tool
run: dotnet publish --configuration Release --output ./bin --self-contained --runtime ${{ matrix.rid }} -p:PublishSingleFile=true -p:DebugType=None -p:PublishTrimmed=true ./src/Microsoft.ComponentDetection

- name: Publish CLI tool
uses: shogo82148/[email protected]
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./bin/*
asset_name: component-detection-${{ matrix.rid }}${{ matrix.rid == 'win-x64' && '.exe' || '' }}

- name: Build NuGet packages
run: dotnet pack --configuration Release --output ./out

- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push ./out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}

- name: Publish NuGet packages to Azure Artifacts
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 comments on commit a607edc

Please sign in to comment.