Skip to content

Commit

Permalink
Update workflows from oss template
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Aug 8, 2024
1 parent ba2f1a1 commit bc1a676
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 33 deletions.
40 changes: 23 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@
name: build
on:
workflow_dispatch:
inputs:
configuration:
type: choice
description: Configuration
options:
- Release
- Debug
push:
branches: [ main, dev, 'feature/*', 'rel/*' ]
branches: [ main, dev, 'dev/*', 'feature/*', 'rel/*' ]
paths-ignore:
- docs/**/*
- changelog.md
- readme.md
pull_request:
types: [opened, synchronize, reopened]

env:
DOTNET_NOLOGO: true
Configuration: Release
PackOnBuild: true
GeneratePackageOnBuild: true
VersionPrefix: 42.42.${{ github.run_number }}
VersionLabel: ${{ github.ref }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
MSBUILDTERMINALLOGGER: auto
Configuration: ${{ github.event.inputs.configuration || 'Release' }}

defaults:
run:
Expand All @@ -27,10 +38,7 @@ jobs:
runs-on: windows-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
uses: actions/checkout@v4

- name: ⚙ msbuild
uses: microsoft/[email protected]
Expand All @@ -42,27 +50,28 @@ jobs:
dotnet restore Scenarios/given_a_packaging_project/a.nuproj
msbuild -r
- name: 📦 binlog
- name: 🐛 logs
uses: actions/upload-artifact@v3
if: always()
if: runner.debug && always()
with:
name: binlog-build-${{ github.run_number }}
path: src/NuGetizer.Tests/msbuild.binlog

- name: 🧪 test
uses: ./.github/workflows/test
run: |
dotnet tool update -g dotnet-retest
dotnet retest -- --no-build
- name: 📦 pack
run: dotnet pack -m:1

- name: 📦 binlog
- name: 🐛 logs
uses: actions/upload-artifact@v3
if: always()
if: runner.debug && always()
with:
name: binlog-pack-${{ github.run_number }}
path: msbuild.binlog

# Only push CI package to sleet feed if building on ubuntu (fastest)
- name: 🚀 sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
Expand All @@ -75,10 +84,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
uses: actions/checkout@v4

- name: ✓ ensure format
run: |
Expand Down
43 changes: 27 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@
name: publish
on:
release:
types: [released]
types: [prereleased, released]

env:
DOTNET_NOLOGO: true
Configuration: Release

defaults:
run:
shell: bash
PackOnBuild: true
GeneratePackageOnBuild: true
VersionLabel: ${{ github.ref }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
MSBUILDTERMINALLOGGER: auto

jobs:
publish:
runs-on: windows-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
uses: actions/checkout@v4

- name: ⚙ msbuild
uses: microsoft/[email protected]
Expand All @@ -35,25 +33,38 @@ jobs:
dotnet restore Scenarios/given_a_packaging_project/a.nuproj
msbuild -r
- name: 📦 binlog
- name: 🐛 logs
uses: actions/upload-artifact@v3
if: always()
if: runner.debug && always()
with:
name: binlog-build-${{ github.run_number }}
path: src/NuGetizer.Tests/msbuild.binlog

- name: 🧪 test
uses: ./.github/workflows/test
run: |
dotnet tool update -g dotnet-retest
dotnet retest -- --no-build
- name: 📦 pack
run: dotnet pack -p:version=${GITHUB_REF#refs/*/v}
run: dotnet pack

- name: 📦 binlog
- name: 🐛 logs
uses: actions/upload-artifact@v3
if: always()
if: runner.debug && always()
with:
name: binlog-pack-${{ github.run_number }}
path: msbuild.binlog

- name: 🚀 nuget
run: dotnet nuget push ./bin/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
if: env.NUGET_API_KEY != ''
run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate

- name: 🚀 sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
if: env.SLEET_CONNECTION != ''
run: |
dotnet tool install -g --version 4.0.18 sleet
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"

0 comments on commit bc1a676

Please sign in to comment.