secrets naming #3
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
| # to create a new release, run: | |
| #git tag v1.0.0 | |
| #git push origin v1.0.0 | |
| # or use the "Run workflow" button to publish a specific version | |
| name: Publish NuGet | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g., 1.0.0)" | |
| required: true | |
| type: string | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| # Extract version from tag (v1.0.0 -> 1.0.0) | |
| echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Restore dependencies | |
| run: dotnet restore src/DiffLog.csproj | |
| - name: Build | |
| run: dotnet build src/DiffLog.csproj -c Release --no-restore -p:Version=${{ steps.version.outputs.VERSION }} -p:CommitHash=${{ github.sha }} | |
| - name: Pack | |
| run: dotnet pack src/DiffLog.csproj -c Release --no-build -o ./artifacts -p:Version=${{ steps.version.outputs.VERSION }} -p:CommitHash=${{ github.sha }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: ./artifacts/*.nupkg | |
| - name: Publish to NuGet | |
| run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| - name: Publish to GitHub Packages | |
| run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate | |
| - name: Install DiffLog | |
| run: dotnet tool install -g DiffLog | |
| - name: Generate Release Notes | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPEN_AI_API_KEY }} | |
| run: | | |
| PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| CURRENT_TAG=${GITHUB_REF#refs/tags/v} | |
| if [ -n "$PREV_TAG" ]; then | |
| difflog generate --from $PREV_TAG --to v$CURRENT_TAG --format Markdown -o release-notes.md --system-prompt "Generate developer friendly release notes based on this git history information. Include SHA hashes and structure the changelog in bullet points. don't make it too long. keep it clean." | |
| else | |
| difflog generate --to v$CURRENT_TAG --format Markdown -o release-notes.md --system-prompt "Generate developer friendly release notes based on this git history information. Include SHA hashes and structure the changelog in bullet points. don't make it too long. keep it clean." | |
| fi | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ./artifacts/*.nupkg | |
| body_path: release-notes.md |