docs: document v0.0.3 release (#16) #1
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: Create Pre-Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*-rc.*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Pre-release tag (e.g., v1.0.0-rc.1)' | |
| required: true | |
| type: string | |
| jobs: | |
| determine-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| prerelease_version: ${{ env.PRERELEASE_VERSION }} | |
| changelog_body: ${{ env.CHANGELOG_BODY }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version from tag | |
| id: get_version | |
| run: | | |
| # Get version from tag (either from push event or manual input) | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| VERSION="${{ github.ref_name }}" | |
| else | |
| VERSION="${{ inputs.tag }}" | |
| fi | |
| # Validate version format using make target | |
| make validate-prerelease-tag VERSION="$VERSION" | |
| echo "PRERELEASE_VERSION=$VERSION" >> "$GITHUB_ENV" | |
| echo "Pre-release version: $VERSION" | |
| - name: Extract changelog | |
| id: changelog | |
| run: | | |
| VERSION="${{ env.PRERELEASE_VERSION }}" | |
| # Extract the base release version (without -rc.N suffix) | |
| RELEASE_VERSION=$(echo "$VERSION" | sed 's/-rc\.[0-9]*$//') | |
| # Extract changelog using make target (tries version-specific, then unreleased) | |
| CHANGELOG_CONTENT=$(make extract-changelog-version VERSION="$RELEASE_VERSION" 2>/dev/null || echo "Pre-release build for ${RELEASE_VERSION}. See CHANGELOG.md for details.") | |
| # Save to environment variable, handling multiline content | |
| { | |
| echo 'CHANGELOG_BODY<<EOF' | |
| echo "$CHANGELOG_CONTENT" | |
| echo 'EOF' | |
| } >> "$GITHUB_ENV" | |
| - name: Create or update pre-release | |
| run: | | |
| VERSION="${{ env.PRERELEASE_VERSION }}" | |
| # Check if release already exists | |
| if gh release view "$VERSION" >/dev/null 2>&1; then | |
| echo "Pre-release $VERSION already exists, checking if changelog needs to be updated..." | |
| # Get current release notes | |
| CURRENT_NOTES=$(gh release view "$VERSION" --json body -q .body) | |
| # Check if changelog content is already in the notes | |
| if echo "$CURRENT_NOTES" | grep -qF "${{ env.CHANGELOG_BODY }}"; then | |
| echo "Changelog already present in release notes, skipping update..." | |
| else | |
| echo "Appending changelog to existing release notes..." | |
| NEW_NOTES="${CURRENT_NOTES}\n\n---\n\n${{ env.CHANGELOG_BODY }}" | |
| gh release edit "$VERSION" --notes "$NEW_NOTES" | |
| fi | |
| else | |
| echo "Creating pre-release $VERSION..." | |
| gh release create "$VERSION" \ | |
| --title "$VERSION" \ | |
| --notes "${{ env.CHANGELOG_BODY }}" \ | |
| --prerelease | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-and-upload: | |
| needs: determine-version | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write # Permission for keyless signing | |
| strategy: | |
| matrix: | |
| goos: [linux, windows, darwin] | |
| goarch: [amd64, arm64] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Install cosign | |
| uses: sigstore/cosign-installer@v4.0.0 | |
| - name: Build release artifacts | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| VERSION: ${{ needs.determine-version.outputs.prerelease_version }} | |
| run: make build-release package-release | |
| - name: Sign release artifacts | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: make sign-release | |
| - name: Upload assets to release | |
| run: make upload-release-assets VERSION="${{ needs.determine-version.outputs.prerelease_version }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |