Merge pull request #33 from bornlogic/feature/validate-scopes-conside… #111
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: Test and Publish | |
on: | |
push: | |
branches: [ master ] | |
defaults: | |
run: | |
shell: bash | |
env: | |
GPR_USERNAME: ${{ secrets.GPR_USERNAME }} | |
GPR_TOKEN: ${{ secrets.GPR_TOKEN }} | |
DOTNET_VERSION: 8.0.x | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install .NET Core | |
if: ${{ success() }} | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Test | |
if: ${{ success() }} | |
run: dotnet test | |
build: | |
name: Publish | |
runs-on: ubuntu-22.04 | |
needs: test | |
env: | |
LAST_COMMITTER_EMAIL: $(git log -1 --pretty=format:'%ae') | |
BOT_NAME: Actions | |
BOT_EMAIL: actions@bornlogic.com | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET Core for Versionize | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.300 | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Build | |
if: ${{ success() }} | |
run: dotnet build --configuration Release | |
- name: Increment Version | |
if: ${{ success() && env.LAST_COMMITTER_EMAIL != env.BOT_EMAIL }} | |
run: | | |
git config --global user.name ${{ env.BOT_NAME }} | |
git config --global user.email ${{ env.BOT_EMAIL }} | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git checkout "${GITHUB_REF:11}" | |
dotnet tool install --global Versionize --version 1.8.0 | |
versionize --skip-dirty && git push --follow-tags origin "${GITHUB_REF:11}" | |
- name: Pack | |
if: ${{ success() }} | |
run: dotnet pack --configuration Release -o output | |
- name: Publish | |
if: ${{ success() }} | |
run: | | |
dotnet --version | |
dotnet nuget push "output/*.nupkg" \ | |
--source https://nuget.pkg.github.com/bornlogic/index.json \ | |
--api-key ${{ secrets.GITHUB_TOKEN }} \ | |
--skip-duplicate --no-symbols |