v3.0.0-beta #14
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: Release | |
| on: | |
| release: | |
| types: | |
| - published | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish-nuget: | |
| runs-on: ubuntu-latest | |
| env: | |
| solution: WordPressPCL.sln | |
| project: src/WordPressPCL/WordPressPCL.csproj | |
| release_tag: ${{ github.event.release.tag_name }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.x | |
| - name: Validate release tag | |
| id: version | |
| run: | | |
| version="${release_tag#v}" | |
| if [[ ! "$release_tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.-]+)?$ ]]; then | |
| echo "Release tag '$release_tag' must use the format v<major>.<minor>.<patch>[-suffix]." | |
| exit 1 | |
| fi | |
| echo "value=$version" >> "$GITHUB_OUTPUT" | |
| - name: Restore | |
| run: dotnet restore ${{ env.solution }} --disable-parallel | |
| - name: Build | |
| run: dotnet build ${{ env.solution }} -c Release --no-restore -p:Version=${{ steps.version.outputs.value }} | |
| - name: Pack | |
| run: dotnet pack ${{ env.project }} -c Release --no-build -o artifacts -p:Version=${{ steps.version.outputs.value }} | |
| - name: Publish to NuGet | |
| run: dotnet nuget push "artifacts/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.WORDPRESSPCLNUGET }} --skip-duplicate |