Skip to content

feat: reference threads account (#103) #5

feat: reference threads account (#103)

feat: reference threads account (#103) #5

Workflow file for this run

name: Release
on:
push:
branches:
- master
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Archive build artifacts
run: |
cd public
zip -r ../website-build.zip .
cd ..
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: website-build.zip
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for changelog generation
- name: Get version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=v${VERSION}" >> $GITHUB_OUTPUT
echo "Version: v${VERSION}"
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Generate changelog
id: changelog
run: |
# Get the latest tag (if exists)
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
COMMIT_SHA="${{ github.sha }}"
SHORT_SHA=$(echo "$COMMIT_SHA" | cut -c1-7)
if [ -z "$LATEST_TAG" ]; then
# No previous tags, show last 10 commits
CHANGELOG=$(git log --pretty=format:"- %s ([%h](https://github.com/${{ github.repository }}/commit/%H))" -10)
FILES_CHANGED=$(git diff --stat ${COMMIT_SHA}~10..${COMMIT_SHA} --stat-width=80 | tail -1)
COMPARE_URL=""
PREVIOUS_TAG="Initial release"
else
# Get commits since last tag
CHANGELOG=$(git log ${LATEST_TAG}..${COMMIT_SHA} --pretty=format:"- %s ([%h](https://github.com/${{ github.repository }}/commit/%H))")
FILES_CHANGED=$(git diff --stat ${LATEST_TAG}..${COMMIT_SHA} --stat-width=80 | tail -1)
COMPARE_URL="https://github.com/${{ github.repository }}/compare/${LATEST_TAG}...${SHORT_SHA}"
PREVIOUS_TAG="$LATEST_TAG"
fi
# Handle empty changelog
if [ -z "$CHANGELOG" ]; then
CHANGELOG="- ${{ github.event.head_commit.message }} ([$SHORT_SHA](https://github.com/${{ github.repository }}/commit/$COMMIT_SHA))"
fi
# Output using multiline string
echo "changes<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "files_changed=$FILES_CHANGED" >> $GITHUB_OUTPUT
echo "compare_url=$COMPARE_URL" >> $GITHUB_OUTPUT
echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.version }}-${{ github.run_number }}
name: Release ${{ steps.version.outputs.version }} (Build ${{ github.run_number }})
body: |
## πŸš€ Deployed to Netlify
- **Version:** ${{ steps.version.outputs.version }}
- **Build:** #${{ github.run_number }}
- **Commit:** [`${{ steps.changelog.outputs.short_sha }}`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
🌐 **[Launch Website β†’](${{ 'https://gear.dev/' }})**
---
### πŸ“‹ Changes
${{ steps.changelog.outputs.changes }}
### πŸ“Š Files Changed
```
${{ steps.changelog.outputs.files_changed }}
```
### πŸ” Compare
${{ steps.changelog.outputs.compare_url && format('- [**{0}** β†’ **{1}** β€” View full diff]({2})', steps.changelog.outputs.previous_tag, format('{0}-{1}', steps.version.outputs.version, github.run_number), steps.changelog.outputs.compare_url) || '*(Initial release β€” no previous version to compare)*' }}
files: redact-check-build.zip
draft: false
prerelease: false