88 types :
99 - closed
1010 paths-ignore :
11- - ' docs/**'
11+ - ' docs/**'
1212
1313 workflow_dispatch :
14-
15- jobs :
14+
15+ jobs :
1616 release :
1717 name : 🎁 Publish new release
1818 # Only run on manual dispatch or on merged 'release-' pull requests
19- if : github.ref == 'refs/heads/stable' ||
19+ if : github.ref == 'refs/heads/stable' ||
2020 github.event.pull_request.merged == true && contains(github.head_ref, 'release/v') == true
2121 runs-on : ubuntu-latest
2222 steps :
23-
23+
2424 - name : 🛒 Checkout repository
25- uses : actions/checkout@v2
25+ uses : actions/checkout@v3
2626 with :
2727 fetch-depth : 0
2828 token : ${{ secrets.BUNIT_BOT_TOKEN }}
29-
29+
3030 - name : 🛠️ Get Changelog Entry
3131 id : changelog_reader
3232 uses : mindsers/changelog-reader-action@v2
3333 with :
3434 version : Unreleased
3535 path : ./CHANGELOG.md
36-
36+
3737 - name : ☑ Check that release contains changes
3838 if : steps.changelog_reader.outputs.changes == ''
3939 run : |
4040 echo "::error file=CHANGELOG.md::The unreleased section in the changelog is empty. Nothing to release."
4141 exit 1
42-
42+
4343 - name : ⚙️ Import GPG key
4444 id : import_gpg
4545 uses : crazy-max/ghaction-import-gpg@v3
4646 with :
4747 gpg-private-key : ${{ secrets.BUNIT_BOT_GPG_PRIVATE_KEY }}
4848 passphrase : ${{ secrets.BUNIT_BOT_GPG_KEY_PASSPHRASE }}
49-
49+
5050 - name : ⚙️ Setup CI GIT
5151 run : |
5252 git config user.name "${{ steps.import_gpg.outputs.name }}"
5353 git config user.email ${{ steps.import_gpg.outputs.email }}
5454 git config --global user.signingkey ${{ steps.import_gpg.outputs.keyid }}
55- git config --global commit.gpgsign true
56-
55+ git config --global commit.gpgsign true
56+
5757 - name : ⚙️ Setup GIT versioning
5858 uses : dotnet/nbgv@v0.4.0
5959 with :
60- setAllVars : true
61-
62- - name : ⚙️ Setup dotnet 5.0.x
63- uses : actions/setup-dotnet@v1
60+ setAllVars : true
61+
62+ - name : ⚙️ Setup dotnet versions
63+ uses : actions/setup-dotnet@v3
6464 with :
65- dotnet-version : ' 5.0.x'
65+ dotnet-version : |
66+ 3.1.x
67+ 5.0.x
68+ 6.0.x
69+ 7.0.x
70+ include-prerelease : true
6671
6772 - name : 🛠️ Update changelog
6873 uses : thomaseizinger/keep-a-changelog-new-release@1.2.1
6974 with :
7075 version : ${{ env.NBGV_SemVer2 }}
71-
76+
7277 - name : 🛠️ Update changelog compare URLs
7378 shell : bash
7479 run : |
7580 sed -i -E "s/compare\/([0-9]+\.[0-9]+\.[0-9]+)\.\.\.([0-9]+\.[0-9]+\.[0-9]+)/compare\/v\1...v\2/" CHANGELOG.md
7681 sed -i -E "s/compare\/([0-9]+\.[0-9]+\.[0-9]+)\.\.\.HEAD/compare\/v\1...HEAD/" CHANGELOG.md
77-
82+
7883 - name : 🛠️ Commit CHANGELOG.md to stable branch
7984 run : |
8085 git add CHANGELOG.md
8186 git commit -S -m "Updated CHANGELOG.md for ${{ env.NBGV_SimpleVersion }} release"
8287 echo "RELEASE_COMMIT_HASH=$(git rev-parse stable)" >> $GITHUB_ENV
8388
84- - name : 🛠️ Building library in release mode
85- run : dotnet pack src/ -c release -p:ContinuousIntegrationBuild=true
86-
89+ - name : 🛠️ Update tokens in project files
90+ uses : cschleiden/replace-tokens@v1
91+ with :
92+ files : ' ["*.csproj", "**/*.csproj"]'
93+
94+ - name : 🛠️ Packing library in release mode
95+ run : |
96+ dotnet pack -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
97+ dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
98+ dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
99+
87100 - name : 🛠️ Upload library to NuGet.org repository
88- run : echo "TODO"
101+ run : |
102+ dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols
89103
90104 - name : ⏩ Push stable branch
91105 run : git push origin stable
@@ -97,19 +111,19 @@ jobs:
97111 with :
98112 tag_name : v${{ env.NBGV_SemVer2 }}
99113 target_commitish : ${{ env.RELEASE_COMMIT_HASH }}
100- name : Release ${{ env.NBGV_SemVer2 }}
114+ name : ${{ env.NBGV_SemVer2 }}
101115 body : ${{ steps.changelog_reader.outputs.changes }}
102116 draft : false
103117 prerelease : ${{ env.NBGV_PublicRelease == 'False' }}
104-
105- - name : ⏩ Merge stable with main, push main
118+
119+ - name : ⏩ Merge stable with main, push to origin
106120 id : mergeMainline
107121 continue-on-error : true
108- run : |
122+ run : |
109123 git checkout main
110124 git merge -S stable
111125 git push origin main
112-
126+
113127 - name : ⏭ Create pull request from stable to main when direct merge fails
114128 if : steps.mergeMainline.outcome == 'failure'
115129 uses : thomaseizinger/create-pull-request@1.0.0
@@ -122,5 +136,5 @@ jobs:
122136 reviewers : ${{ github.actor }} # By default, we request a review from the person who triggered the workflow.
123137 body : |
124138 Hi @${{ github.actor }}
125-
139+
126140 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.
0 commit comments