release-preview #429
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release-preview | |
concurrency: 'release-preview' | |
on: | |
workflow_run: | |
workflows: [ 'verification' ] | |
types: [completed] | |
branches: [main, v2] | |
workflow_dispatch: | |
inputs: | |
nugetRelease: | |
description: 'Release to NuGet? Set to "true" to release to NuGet.org as well as GPR.' | |
required: true | |
default: 'false' | |
jobs: | |
release-preview: | |
if: github.event_name == 'workflow_dispatch' || (github.ref == 'refs/heads/main' && ${{ github.event.workflow_run.conclusion == 'success' }}) || (github.ref == 'refs/heads/v2' && ${{ github.event.workflow_run.conclusion == 'success' }}) | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛒 Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: ⚙️ Setup GIT versioning | |
uses: dotnet/[email protected] | |
- name: ⚙️ Setup dotnet versions | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
3.1.x | |
5.0.x | |
6.0.x | |
7.0.x | |
- name: 🎨 Setup color | |
run: | | |
echo "DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION=1" >> $GITHUB_ENV | |
echo "TERM=xterm" >> $GITHUB_ENV | |
- name: 🛠️ Update tokens in project files | |
uses: cschleiden/replace-tokens@v1 | |
with: | |
files: '["*.csproj", "**/*.csproj"]' | |
- name: 🛠️ Packing library in release mode | |
run: | | |
dotnet pack -c Release --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | |
dotnet pack src/bunit/ -c Release --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | |
dotnet pack src/bunit.template/ -c Release --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | |
- name: 🛠️ Upload library to GitHub Package Repository | |
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/bunit-dev/index.json --skip-duplicate --no-symbols | |
- name: 🛠️ Upload library to NuGet.org repository | |
if: github.event.inputs.nugetRelease == 'true' | |
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols |