Skip to content

feat: Free Models page with provider logos and public API (#1608) #639

feat: Free Models page with provider logos and public API (#1608)

feat: Free Models page with provider logos and public API (#1608) #639

Workflow file for this run

name: Release
on:
push:
branches: [main]
permissions:
actions: write
contents: write
pull-requests: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.detect.outputs.should_publish }}
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- uses: changesets/action@v1
id: changesets
with:
createGithubReleases: false
version: npm run version-packages
title: "chore: version packages"
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Detect version bump
id: detect
env:
BEFORE_SHA: ${{ github.event.before }}
run: |
# Read CURR from HEAD (not the working tree) because
# changesets/action runs `npm run version-packages` in place and
# may have mutated packages/manifest/package.json on disk.
CURR=$(git show HEAD:packages/manifest/package.json 2>/dev/null | jq -r .version 2>/dev/null || echo "")
# Compare against the push base so multi-commit pushes are handled
# correctly. On first push to a branch, BEFORE_SHA is all zeros.
if [ -n "$BEFORE_SHA" ] && [ "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then
PREV=$(git show "${BEFORE_SHA}:packages/manifest/package.json" 2>/dev/null | jq -r .version 2>/dev/null || echo "")
else
PREV=""
fi
if [ -n "$PREV" ] && [ -n "$CURR" ] && [ "$PREV" != "$CURR" ]; then
echo "should_publish=true" >> "$GITHUB_OUTPUT"
echo "Version bumped: $PREV -> $CURR"
else
echo "should_publish=false" >> "$GITHUB_OUTPUT"
echo "No version change (PREV=${PREV:-<none>} CURR=${CURR:-<none>})"
fi
github-release:
needs: release
if: needs.release.outputs.should_publish == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(jq -r .version packages/manifest/package.json)
TAG="manifest@${VERSION}"
# Extract changelog section for this version
BODY=$(awk -v ver="## ${VERSION}" \
'$0 == ver { found=1; next } found && /^## / { exit } found { print }' \
packages/manifest/CHANGELOG.md)
# Add emoji headers
BODY=$(echo "$BODY" | sed \
-e 's/^### Major Changes$/### 💥 Major Changes/' \
-e 's/^### Minor Changes$/### ✨ Minor Changes/' \
-e 's/^### Patch Changes$/### 🐛 Patch Changes/')
git tag "$TAG" 2>/dev/null || true
git push origin "$TAG" 2>/dev/null || true
gh release create "$TAG" \
--title "manifest v${VERSION}" \
--notes "${BODY:-No changelog}" \
--verify-tag
publish-docker:
needs: release
if: needs.release.outputs.should_publish == 'true'
uses: ./.github/workflows/docker.yml
secrets: inherit
permissions:
contents: read
id-token: write