Enhance CI/CD workflow with commit verification #26
Workflow file for this run
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: "2. Continuous Deployment (Release)" | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch origin/main | |
| run: git fetch --no-tags origin main:refs/remotes/origin/main --depth=1 | |
| - name: Verify commit exists in origin/main | |
| run: git branch --remote --contains | grep origin/main | |
| - name: Extract release notes | |
| run: | | |
| git log --pretty=format:'%d %s' ${GITHUB_REF} | perl -pe 's| \(.*tag: v(\d+.\d+.\d+(-preview\d{3})?)(, .*?)*\)|\n## \1\n|g' > RELEASE-NOTES | |
| - name: Upload release notes | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-notes | |
| path: RELEASE-NOTES | |
| build-and-pack: | |
| needs: prepare | |
| uses: ./.github/workflows/cd-build-test-pack.yml | |
| with: | |
| version: ${{ github.ref_name }} | |
| configuration: Release | |
| publish: | |
| needs: build-and-pack | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Push to NuGet | |
| run: dotnet nuget push nuget-packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }} |