Files
oh-my-opencode-free-fork/.github/workflows/ci.yml
YeonGyu-Kim b9e373ab39 feat(ci): extract changelog generation script and use for draft releases
- Create script/generate-changelog.ts with reusable changelog generation logic
- Update ci.yml draft-release job to use the new script instead of GitHub's generate-notes API
- Ensures draft release notes follow the same format as published releases

🤖 Generated with assistance of oh-my-opencode
2025-12-19 19:33:51 +09:00

118 lines
2.9 KiB
YAML

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
env:
BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi"
- name: Run tests
run: bun test
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
env:
BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi"
- name: Type check
run: bun run typecheck
build:
runs-on: ubuntu-latest
needs: [test, typecheck]
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
env:
BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi"
- name: Build
run: bun run build
- name: Verify build output
run: |
test -f dist/index.js || (echo "ERROR: dist/index.js not found!" && exit 1)
test -f dist/index.d.ts || (echo "ERROR: dist/index.d.ts not found!" && exit 1)
draft-release:
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Generate release notes
id: notes
run: |
NOTES=$(bun run script/generate-changelog.ts)
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create or update draft release
run: |
EXISTING_DRAFT=$(gh release list --json tagName,isDraft --jq '.[] | select(.isDraft == true and .tagName == "next") | .tagName')
if [ -n "$EXISTING_DRAFT" ]; then
echo "Updating existing draft release..."
gh release edit next \
--title "Upcoming Changes 🍿" \
--notes "${{ steps.notes.outputs.notes }}" \
--draft
else
echo "Creating new draft release..."
gh release create next \
--title "Upcoming Changes 🍿" \
--notes "${{ steps.notes.outputs.notes }}" \
--draft \
--target ${{ github.sha }}
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}