-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish NuGet packages from PR (#952)
- Loading branch information
1 parent
3fb8e8e
commit cf91ff8
Showing
3 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: PR actions | ||
on: | ||
issue_comment: | ||
types: [created, edited] | ||
jobs: | ||
publish: | ||
name: Publish PR packages | ||
runs-on: ubuntu-latest | ||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/publish') | ||
env: | ||
DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE: false | ||
steps: | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: | | ||
8.0.x | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
|
||
- name: Build PR release version | ||
run: | | ||
dotnet tool restore | ||
sha=$(echo '${{ github.event.pull_request.head.sha }}' | cut -c1-8) | ||
# Get the last part of the branch name if it contains a slash | ||
branch=$(echo '${{ github.event.pull_request.head.ref }}' | sed 's/.*\///') | ||
version=$(dotnet minver --tag-prefix v --ignore-height --default-pre-release-identifiers preview.0).$branch.$sha | ||
echo "MINVERVERSIONOVERRIDE=$version" >> $GITHUB_ENV | ||
echo $version | ||
- name: Build | ||
run: | | ||
dotnet build AppLibDotnet.sln -v m -c Release | ||
- name: Test | ||
run: | | ||
dotnet test AppLibDotnet.sln -v m --no-restore --no-build -c Release | ||
- name: Pack PR release | ||
run: | | ||
dotnet pack AppLibDotnet.sln -v m --no-restore --no-build -c Release -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} | ||
- name: Versions | ||
run: | | ||
dotnet --version | ||
- name: Publish PR release | ||
run: | | ||
dotnet nuget push src/**/bin/Release/*.nupkg --source https://nuget.pkg.github.com/Altinn/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |
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