[devops] add release workflow, pull_request trigger, and checkout v7 … #124
This file contains hidden or 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 Package | |
| on: | |
| push: | |
| pull_request: | |
| defaults: | |
| run: | |
| working-directory: src | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install DotNet | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Restore Dependencies | |
| run: dotnet restore | |
| - name: Build Packages | |
| run: dotnet build --no-restore -c Release | |
| - name: Perform Unit Testing | |
| run: dotnet test --no-build -c Release --verbosity normal | |
| - name: Create Packages | |
| run: dotnet pack --no-build -c Release -o ./publish | |
| - name: Create packages artifact | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Packages | |
| path: ./src/publish/ | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: build | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Extract changelog entry | |
| run: | | |
| awk '/^## \[/{if(f) exit; f=1; next} f' \ | |
| Simplify.Web.Swagger/CHANGELOG.md \ | |
| > /tmp/release_notes.md | |
| - name: Create release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "${{ github.ref_name }}" \ | |
| --title "${{ github.ref_name }}" \ | |
| --notes-file /tmp/release_notes.md |