Merge branch 'dev' of https://github.com/Somfic/EliteAPI into dev #596
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: ci | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
jobs: | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup .NET 7 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "7.0.x" | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release | |
- name: Test | |
run: dotnet test --configuration Release --logger trx --results-directory reports --collect:"XPlat Code Coverage" | |
- name: Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
with: | |
name: report | |
path: reports/*.trx | |
reporter: dotnet-trx | |
release: | |
name: release | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
env: | |
nuget_key: ${{ secrets.NUGET_KEY }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup .NET 7 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "7.0.x" | |
- name: Setup GitVersion | |
run: dotnet tool install --global GitVersion.Tool | |
- name: Fetch Git tags | |
run: git fetch --tags --unshallow | |
- name: Fetch main branch | |
if: github.ref != 'refs/heads/main' | |
run: git branch --create-reflog main origin/main | |
- name: Query last tag | |
id: LAST | |
run: echo ::set-output name=tag::$(git describe --tags --abbrev=0) | |
- name: Update version | |
run: dotnet-gitversion /updateprojectfiles /updateassemblyinfo /output buildserver | |
- name: Build | |
run: dotnet build --configuration Release | |
- name: Pack | |
if: ${{env.nuget_key != ''}} | |
run: dotnet pack --configuration Release --output nupkgs --include-symbols --include-source | |
- name: Setup Ruby v3 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.0" | |
- name: Set up new Gemfile | |
run: bundle init | |
- name: Install changelog generator | |
run: gem install github_changelog_generator | |
- name: Install changelog generator | |
run: gem 'github_changelog_generator', '~> 1.15.1' | |
- name: Install dependencies | |
run: bundle install | |
- name: Install changelog generator | |
run: gem install github_changelog_generator | |
- name: Generate changelog | |
run: bundle exec github_changelog_generator -u ${{github.repository_owner}} -p ${{github.event.repository.name}} --token ${{secrets.GITHUB_TOKEN}} --since-tag ${{ steps.LAST.outputs.previous}} --future-release ${{ env.GitVersion_LegacySemVer }} | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
tag_name: ${{ env.GitVersion_LegacySemVer }} | |
name: v${{ env.GitVersion_LegacySemVer }} | |
body_path: CHANGELOG.md | |
prerelease: ${{ env.GitVersion_PreReleaseLabel == 'alpha' || env.GitVersion_PreReleaseLabel == 'beta' }} | |
- name: Publish project to NuGet | |
if: ${{env.nuget_key != ''}} | |
run: dotnet nuget push '**/*.nupkg' -k ${{ env.nuget_key }} -s https://api.nuget.org/v3/index.json --skip-duplicate | |
- name: Push version bump | |
if: ${{env.GitVersion_PreReleaseLabel == '' || env.GitVersion_PreReleaseLabel == 'alpha' || env.GitVersion_PreReleaseLabel == 'beta'}} | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: github-actions[bot] | |
author_email: github-actions[bot]@users.noreply.github.com | |
message: "Bumped version to ${{ env.GitVersion_LegacySemVer }}" | |
approve: | |
name: approve | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Approve pull request | |
uses: juliangruber/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
number: ${{ github.event.number }} |