build(deps): Bump Microsoft.Extensions.Http.Polly #266
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: Build, Release, Publish | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
unit-test: | |
runs-on: ${{ matrix.os }} | |
needs: [] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: app | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
- name: Build with dotnet | |
run: dotnet build --configuration Release | |
working-directory: app | |
- name: Generate coverage report | |
run: dotnet test --collect:"XPlat Code Coverage" --results-directory "test-results" | |
working-directory: app | |
- name: Move coverage report from GUID folder to test-results | |
run: find test-results -name "coverage.cobertura.xml" -exec mv {} test-results \; | |
shell: bash | |
working-directory: app | |
if: ${{ always() }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: app/test-results/coverage.cobertura.xml | |
fail_ci_if_error: true | |
if: ${{ always() && matrix.os == 'ubuntu-latest' }} | |
- name: Upload dotnet test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: testresults-unit-${{ matrix.os }} | |
path: app/test-results | |
if-no-files-found: error | |
if: ${{ always() }} | |
- name: Pack binaries | |
run: dotnet pack | |
working-directory: app | |
- name: Upload binaries as ${platform}-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ matrix.os }} | |
path: app/FFXIVDiscordChatBridge/bin/Release | |
if-no-files-found: error | |
if: ${{ always() }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [ unit-test ] | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.ELEVATED_GITHUB_TOKEN || github.token }} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
- name: Setup git | |
run: | | |
git config --local user.email "versionize-bot@by.vincent.mahn.ke" | |
git config --local user.name "Versionize Bot" | |
- name: Install Versionize | |
run: dotnet tool install --global Versionize | |
- name: Run Versionize | |
id: versionize | |
run: 'versionize --changelog-all --exit-insignificant-commits --commit-suffix " [skip ci]"' | |
continue-on-error: true | |
- name: No release required | |
if: steps.versionize.outcome != 'success' | |
run: echo "Skipping Release. No release required." | |
- name: Push changes to GitHub | |
if: steps.versionize.outcome == 'success' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
tags: true | |
- name: Create NuPkg | |
if: steps.versionize.outcome == 'success' | |
run: dotnet pack --configuration Release | |
- name: Download ubuntu artifacts | |
if: steps.versionize.outcome == 'success' | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries-ubuntu-latest | |
path: ubuntu-artifacts | |
- name: Download windows artifacts | |
if: steps.versionize.outcome == 'success' | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries-windows-latest | |
path: windows-artifacts | |
- name: Download macos artifacts | |
if: steps.versionize.outcome == 'success' | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries-macos-latest | |
path: macos-artifacts | |
- run: | | |
version=$(git describe --tags --abbrev=0) | |
zip -r FFXIVDiscordChatBridge-ubuntu-x64-$version.zip ubuntu-artifacts | |
zip -r FFXIVDiscordChatBridge-windows-x64-$version.zip windows-artifacts | |
zip -r FFXIVDiscordChatBridge-macos-x64-$version.zip macos-artifacts | |
if: steps.versionize.outcome == 'success' | |
- name: "Create release with all artifacts" | |
if: steps.versionize.outcome == 'success' | |
run: | | |
version=$(git describe --tags --abbrev=0) | |
gh release create $version \ | |
-t "$version" \ | |
-R ${{ github.repository }} \ | |
--target ${{ github.sha }} \ | |
--title "$version" \ | |
-F CHANGELOG.md \ | |
FFXIVDiscordChatBridge-ubuntu-x64-$version.zip \ | |
FFXIVDiscordChatBridge-windows-x64-$version.zip \ | |
FFXIVDiscordChatBridge-macos-x64-$version.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | |
shell: bash |