Merge pull request #1 from DeNA/fix-workflow #1
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: publish | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'com.dena.must-await-analyzer/package.json' | |
jobs: | |
check-bump-version: | |
runs-on: ubuntu-latest | |
outputs: | |
new-version: ${{ steps.diff.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 200 | |
- name: Get version number diff | |
run: | | |
version="$(git diff ${{ github.event.before }}..${{ github.event.after }} com.dena.must-await-analyzer/package.json | sed -nr '/^\+ +\"version\":/p' | sed -r 's/^.*\"([0-9a-z\.\-\+]+)\"*.$/\1/')" | |
echo "version=$version" >> "$GITHUB_OUTPUT" | |
id: diff | |
publish: | |
needs: check-bump-version | |
if: ${{ needs.check-bump-version.outputs.new-version }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
- name: Setup .NET | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: '6.0.x' | |
- name: Install dependencies | |
run: dotnet restore ./MustAwaitAnalyzer.sln | |
- name: dotnet build | |
run: dotnet build ./MustAwaitAnalyzer.sln --configuration Release --no-restore | |
- name: Push UPM package | |
run: | | |
cp ./MustAwaitAnalyzer/bin/Release/netstandard2.0/MustAwaitAnalyzer.dll ./com.dena.must-await-analyzer/Analyzers/ | |
cp ./README.md* ./com.dena.must-await-analyzer/ | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git commit -m "Bump up version" | |
git tag ${{ needs.check-bump-version.outputs.new-version }} | |
git push --tags | |
git push origin master | |
- name: Create NuPkg | |
run: dotnet pack ./MustAwaitAnalyzer --include-symbols --configuration Release -o ./nupkg | |
- name: Publish NuPkg | |
run: dotnet nuget push ./nupkg/MustAwaitAnalyzer.*.symbols.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }} |