fix: remove Stats.tsx from gitignore to fix Netlify build error #32
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 Release from Changelog | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'changelog.md' | |
| permissions: | |
| contents: write | |
| discussions: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract latest version from changelog | |
| id: changelog | |
| run: | | |
| # Get the first versioned section (skip [Unreleased]) | |
| VERSION=$(grep -E '## \[[0-9]+\.[0-9]+\.[0-9]+\]' changelog.md | head -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') | |
| if [ -z "$VERSION" ]; then | |
| echo "No version found in changelog" | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Found version: $VERSION" | |
| # Extract the content for this version | |
| awk -v ver="## \\[$VERSION\\]" ' | |
| $0 ~ ver { found=1; next } | |
| found && /^## \[/ { exit } | |
| found { print } | |
| ' changelog.md > release_body.txt | |
| # Store body for both release and discussion | |
| BODY=$(cat release_body.txt) | |
| echo "body<<CHANGELOG_EOF" >> $GITHUB_OUTPUT | |
| echo "$BODY" >> $GITHUB_OUTPUT | |
| echo "CHANGELOG_EOF" >> $GITHUB_OUTPUT | |
| - name: Check if release already exists | |
| if: steps.changelog.outputs.skip != 'true' | |
| id: check | |
| run: | | |
| if gh release view "v${{ steps.changelog.outputs.version }}" &>/dev/null; then | |
| echo "Release v${{ steps.changelog.outputs.version }} already exists" | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Release v${{ steps.changelog.outputs.version }} does not exist" | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| if: steps.changelog.outputs.skip != 'true' && steps.check.outputs.exists == 'false' | |
| run: | | |
| gh release create "v${{ steps.changelog.outputs.version }}" \ | |
| --title "v${{ steps.changelog.outputs.version }}" \ | |
| --notes "${{ steps.changelog.outputs.body }}" | |
| echo "Created release v${{ steps.changelog.outputs.version }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Discussion Announcement | |
| if: steps.changelog.outputs.skip != 'true' && steps.check.outputs.exists == 'false' | |
| run: | | |
| gh api graphql -f query=' | |
| mutation($repoId: ID!, $categoryId: ID!, $title: String!, $body: String!) { | |
| createDiscussion(input: { | |
| repositoryId: $repoId | |
| categoryId: $categoryId | |
| title: $title | |
| body: $body | |
| }) { | |
| discussion { | |
| url | |
| } | |
| } | |
| } | |
| ' \ | |
| -f repoId="${{ github.repository_id }}" \ | |
| -f categoryId="DIC_kwDOQ70aG84C1Os7" \ | |
| -f title="Release v${{ steps.changelog.outputs.version }}" \ | |
| -f body="${{ steps.changelog.outputs.body }}" | |
| echo "Created discussion for v${{ steps.changelog.outputs.version }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |