Release of new minor version v1.37 #54
Workflow file for this run
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 | |
concurrency: 'release' | |
on: | |
pull_request: | |
branches: | |
- stable | |
types: | |
- closed | |
paths-ignore: | |
- 'docs/**' | |
workflow_dispatch: | |
env: | |
VSTEST_CONNECTION_TIMEOUT: 180 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
TERM: xterm | |
jobs: | |
release: | |
name: 🎁 Publish new release | |
# Only run on manual dispatch or on merged 'release-' pull requests | |
if: github.ref == 'refs/heads/stable' || | |
github.event.pull_request.merged == true && contains(github.head_ref, 'release/v') == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛒 Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.BUNIT_BOT_TOKEN }} | |
- name: ⚙️ Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.BUNIT_BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.BUNIT_BOT_GPG_KEY_PASSPHRASE }} | |
- name: ⚙️ Setup CI GIT | |
run: | | |
git config user.name "${{ steps.import_gpg.outputs.name }}" | |
git config user.email ${{ steps.import_gpg.outputs.email }} | |
git config --global user.signingkey ${{ steps.import_gpg.outputs.keyid }} | |
git config --global commit.gpgsign true | |
- name: ⚙️ Setup GIT versioning | |
uses: dotnet/[email protected] | |
id: nbgv | |
with: | |
setAllVars: true | |
- name: ⚙️ Setup dotnet versions | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
3.1.x | |
5.0.x | |
6.0.x | |
7.0.x | |
8.0.x | |
9.0.x | |
- name: 🛠️ Update changelog | |
uses: thomaseizinger/[email protected] | |
with: | |
version: ${{ steps.nbgv.outputs.SemVer2 }} | |
- name: 🛠️ Update changelog compare URLs | |
shell: bash | |
run: | | |
sed -i -E "s/compare\/([0-9]+\.[0-9]+\.[0-9]+)\.\.\.([0-9]+\.[0-9]+\.[0-9]+)/compare\/v\1...v\2/" CHANGELOG.md | |
sed -i -E "s/compare\/([0-9]+\.[0-9]+\.[0-9]+)\.\.\.HEAD/compare\/v\1...HEAD/" CHANGELOG.md | |
- name: 🛠️ Commit CHANGELOG.md to stable branch | |
run: | | |
git add CHANGELOG.md | |
git commit -S -m "Updated CHANGELOG.md for ${{ steps.nbgv.outputs.SimpleVersion }} release" | |
echo "RELEASE_COMMIT_HASH=$(git rev-parse stable)" >> $GITHUB_ENV | |
- name: 🛠️ Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
version: ${{ steps.nbgv.outputs.SemVer2 }} | |
path: ./CHANGELOG.md | |
- name: 🛠️ Update tokens in project files | |
uses: cschleiden/replace-tokens@v1 | |
with: | |
files: '["docs/site/*.md", "docs/**/*.md", "docs/**/*.tmpl.partial", "*.csproj", "**/*.csproj", "src/Directory.Build.props"]' | |
env: | |
RELEASE_VERSION: ${{ steps.nbgv.outputs.NuGetPackageVersion }} | |
RELEASE_NOTES: ${{ steps.changelog_reader.outputs.changes }} | |
- name: 🛠️ Packing library in release mode | |
run: | | |
dotnet pack src/bunit/ -c Release --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | |
dotnet pack src/bunit.core/ -c Release --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | |
dotnet pack src/bunit.web/ -c Release --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | |
dotnet pack src/bunit.generators/ -c Release --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | |
dotnet pack src/bunit.web.query/ -c Release --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | |
- name: 🛠️ Upload library to NuGet.org repository | |
run: | | |
dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols | |
- name: ⏩ Push stable branch | |
run: git push origin stable | |
- name: 🛠️ Create GitHub release | |
uses: thomaseizinger/[email protected] | |
with: | |
tag_name: v${{ steps.nbgv.outputs.SemVer2 }} | |
target_commitish: ${{ env.RELEASE_COMMIT_HASH }} | |
name: ${{ steps.nbgv.outputs.SemVer2 }} | |
body: ${{ steps.changelog_reader.outputs.changes }} | |
draft: false | |
prerelease: ${{ steps.nbgv.outputs.PublicRelease == 'False' }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: ⏩ Merge stable with main, push to origin | |
id: mergeMainline | |
continue-on-error: true | |
run: | | |
git checkout main | |
git merge -S stable | |
git push origin main | |
- name: ⏭ Create pull request from stable to main when direct merge fails | |
if: steps.mergeMainline.outcome == 'failure' | |
uses: thomaseizinger/[email protected] | |
with: | |
github_token: ${{ secrets.BUNIT_BOT_TOKEN }} | |
head: stable | |
base: main | |
title: Update main with changes in stable after v${{ steps.nbgv.outputs.SemVer2 }} release | |
reviewers: ${{ github.actor }} # By default, we request a review from the person who triggered the workflow. | |
body: | | |
Hi @${{ github.actor }} | |
This PR was created because the [release workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) failed to automatically merge stable into main. |