feat(fetchers): enhance HackerNewsFetcher with timestamp display (#90) #63
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: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| actions: write | |
| jobs: | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| # Automatic releases only continue for explicit release commits. | |
| if: "${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.head_commit.message, 'chore(release): prepare v') }}" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Extract version | |
| id: version | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| COMMIT_MSG: ${{ github.event.head_commit.message }} | |
| run: | | |
| if [ "$EVENT_NAME" = "workflow_dispatch" ]; then | |
| VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | |
| else | |
| FIRST_LINE=$(echo "$COMMIT_MSG" | head -1) | |
| VERSION=$(echo "$FIRST_LINE" | sed -n 's/.*prepare v\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p') | |
| fi | |
| if [ -z "$VERSION" ]; then | |
| echo "Error: Could not determine version" | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=v$VERSION" >> $GITHUB_OUTPUT | |
| echo "Detected version: $VERSION" | |
| - name: Verify version matches Cargo.toml | |
| run: | | |
| CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | |
| if [ "${{ steps.version.outputs.version }}" != "$CARGO_VERSION" ]; then | |
| echo "Error: Commit version (${{ steps.version.outputs.version }}) does not match Cargo.toml version ($CARGO_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version verified: $CARGO_VERSION" | |
| - name: Extract release notes from CHANGELOG | |
| id: changelog | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| NOTES=$(awk "/^## \[$VERSION\]/{found=1; next} /^## \[/{if(found) exit} found{print}" CHANGELOG.md) | |
| echo "$NOTES" > release_notes.md | |
| echo "Release notes extracted for v$VERSION" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: Release ${{ steps.version.outputs.tag }} | |
| body_path: release_notes.md | |
| draft: false | |
| prerelease: false | |
| - name: Trigger publish workflow | |
| run: gh workflow run publish.yml | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |