Merge pull request #15 from hughesjs/ignore-xmlns #5
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: .NET Continuous Deployment | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- src/UniversalDiveDataFormat/** | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test Project | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Run tests | |
run: dotnet test --logger GitHubActions ./src/UniversalDiveDataFormat.sln | |
semantic-release: | |
needs: test | |
name: Create a Package Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 # Need the full commit history for conventional commit | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
- name: Create Nuget Package | |
run: dotnet build -c Release ./src/UniversalDiveDataFormat/UniversalDiveDataFormat.csproj && dotnet pack -c Release -p:PackageVersion=${{ steps.tag_version.outputs.new_version }} -o . ./src/UniversalDiveDataFormat/UniversalDiveDataFormat.csproj | |
- name: Upload Package for Publishing | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PackedLib | |
path: ./*.nupkg | |
github-publish: | |
permissions: | |
packages: write | |
needs: semantic-release | |
name: Publish to Github | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download built project | |
uses: actions/download-artifact@v4 | |
with: | |
name: PackedLib | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Push Package to GitHub | |
run: dotnet nuget push --api-key ${{secrets.GITHUB_TOKEN}} --source "https://nuget.pkg.github.com/hughesjs/index.json" *.nupkg | |
nuget-publish: | |
needs: semantic-release | |
name: Publish to Nuget | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download built project | |
uses: actions/download-artifact@v4 | |
with: | |
name: PackedLib | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Push Package to Nuget | |
run: dotnet nuget push --api-key ${{secrets.NUGET_KEY}} --source "https://api.nuget.org/v3/index.json" *.nupkg |