Release #9
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
| # workflows/release.yml | |
| # | |
| # Release | |
| # Build, publish, and release efcore-paradedb from a validated version. | |
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to release (semver, e.g., 0.1.0)." | |
| type: string | |
| required: true | |
| beta: | |
| description: "Mark this as a prerelease" | |
| type: boolean | |
| default: false | |
| confirmation: | |
| description: "I confirm version bump, changelog update, and green CI." | |
| type: boolean | |
| required: true | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DOTNET_VERSION: 10.0.x | |
| jobs: | |
| release: | |
| name: Build and Publish to NuGet | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| env: | |
| PACKAGES_OUTPUT_DIR: ${{ github.workspace }}/packages | |
| steps: | |
| - name: Validate confirmation | |
| if: ${{ github.event.inputs.confirmation != 'true' }} | |
| run: | | |
| echo "Please confirm the release checklist first." | |
| exit 1 | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Validate version and release state | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| VERSION="${{ github.event.inputs.version }}" | |
| if ! [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then | |
| echo "Invalid version: ${VERSION}" | |
| exit 1 | |
| fi | |
| if git ls-remote --tags origin "refs/tags/v${VERSION}" | grep -q "refs/tags/v${VERSION}$"; then | |
| echo "Tag v${VERSION} already exists." | |
| exit 1 | |
| fi | |
| if gh release view "v${VERSION}" > /dev/null 2>&1; then | |
| echo "GitHub release v${VERSION} already exists." | |
| exit 1 | |
| fi | |
| echo "VERSION=${VERSION}" >> "${GITHUB_ENV}" | |
| echo "Version validation passed for ${VERSION}" | |
| - name: Pack ParadeDB.EntityFrameworkCore | |
| run: | | |
| set -euo pipefail | |
| dotnet pack src/ParadeDB.EntityFrameworkCore.csproj \ | |
| --configuration Release \ | |
| --output "${PACKAGES_OUTPUT_DIR}" \ | |
| -p:PackageVersion="${VERSION}" | |
| ls -l "${PACKAGES_OUTPUT_DIR}" | |
| - name: Publish to NuGet | |
| run: | | |
| set -euo pipefail | |
| dotnet nuget push "${PACKAGES_OUTPUT_DIR}"/*.nupkg \ | |
| --api-key "${{ secrets.NUGET_API_KEY }}" \ | |
| --source https://api.nuget.org/v3/index.json | |
| - name: Create GitHub tag and release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| target_commitish: ${{ github.sha }} | |
| prerelease: ${{ github.event.inputs.beta }} | |
| generate_release_notes: true | |
| files: ${{ env.PACKAGES_OUTPUT_DIR }}/*.nupkg | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Summary | |
| run: | | |
| { | |
| echo "## Released v${VERSION}" | |
| echo | |
| echo "- NuGet: \`ParadeDB.EntityFrameworkCore ${VERSION}\` published" | |
| echo "- GitHub tag: \`v${VERSION}\` created from ${GITHUB_SHA}" | |
| echo "- GitHub release: created and package attached" | |
| } >> "${GITHUB_STEP_SUMMARY}" |