Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish packages to github on release #196

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: Build

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
release:
types: [published]
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand All @@ -14,7 +15,17 @@ env:
CiRunPushSuffix: ${{ github.ref_name }}-ci${{ github.run_number }}
CiRunPullSuffix: pull-${{ github.event.number }}-ci${{ github.run_number }}
jobs:
setup:
runs-on: ubuntu-latest
outputs:
build-suffix: ${{ steps.setup-build.outputs.build-suffix }}
steps:
- name: Setup Build
id: setup-build
run: echo "build-suffix=${{ github.event_name == 'push' && env.CiRunPushSuffix || github.event_name == 'pull_request' && env.CiRunPullSuffix || null }}" >> "$GITHUB_OUTPUT"

build:
needs: [setup]
strategy:
fail-fast: false
matrix:
Expand All @@ -25,6 +36,8 @@ jobs:
configuration: release
collect-packages: true
runs-on: ${{ matrix.os }}
env:
CiBuildVersionSuffix: ${{ needs.setup.outputs.build-suffix }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -43,8 +56,6 @@ jobs:
- name: Pack
id: pack
if: matrix.collect-packages
env:
CiBuildVersionSuffix: ${{ github.event_name == 'push' && env.CiRunPushSuffix || env.CiRunPullSuffix }}
run: dotnet pack --no-build --configuration ${{ matrix.configuration }}

- name: Collect packages
Expand All @@ -60,7 +71,7 @@ jobs:
permissions:
packages: write
needs: [build]
if: github.event_name == 'push'
if: github.event_name == 'push' || github.event_name == 'release'
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
Expand Down