mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-09 02:36:03 +03:00
Add NuGet metadata to library and add two new workflows for master pull requests and releases on github
This commit is contained in:
parent
30c0d22f93
commit
39b7625c23
5 changed files with 113 additions and 1 deletions
37
.github/workflows/master-pr.yml
vendored
Normal file
37
.github/workflows/master-pr.yml
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
check-pr-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout PR branch
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get version from PR branch
|
||||
id: pr_version
|
||||
run: |
|
||||
PR_VERSION=$(grep '<Version>' **/*.csproj | sed -E 's/.*<Version>(.*)<\/Version>.*/\1/')
|
||||
echo "PR_VERSION=$PR_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout master branch
|
||||
run: |
|
||||
git fetch origin master
|
||||
git checkout origin/master
|
||||
|
||||
- name: Get version from master branch
|
||||
id: master_version
|
||||
run: |
|
||||
MASTER_VERSION=$(grep '<Version>' **/*.csproj | sed -E 's/.*<Version>(.*)<\/Version>.*/\1/')
|
||||
echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Compare versions
|
||||
run: |
|
||||
if [ "$(printf '%s\n' "$PR_VERSION" "$MASTER_VERSION" | sort -V | head -n1)" = "$PR_VERSION" ] && [ "$PR_VERSION" != "$MASTER_VERSION" ]; then
|
||||
echo "Version in PR is not higher than master."
|
||||
exit 1
|
||||
else
|
||||
echo "Version in PR is higher than master."
|
||||
fi
|
30
.github/workflows/release-nuget.yml
vendored
Normal file
30
.github/workflows/release-nuget.yml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
release-nuget:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore src/DotTiled.sln
|
||||
- name: Build
|
||||
run: dotnet build --no-restore src/DotTiled.sln
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal src/DotTiled.sln
|
||||
- name: Lint style
|
||||
run: dotnet format style --verify-no-changes --verbosity diagnostic src/DotTiled.sln
|
||||
- name: Lint analyzers
|
||||
run: dotnet format analyzers --verify-no-changes --verbosity diagnostic src/DotTiled.sln
|
||||
- name: Pack
|
||||
run: make pack
|
||||
- name: Publish to NuGet.org
|
||||
run: |
|
||||
dotnet nuget push ./nupkg/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
|
||||
dotnet nuget push ./nupkg/*.snupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
|
Loading…
Add table
Add a link
Reference in a new issue