chore: bump to 2.0.3 #11
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] | |
| jobs: | |
| publish: | |
| name: Build & Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Run tests | |
| run: bun test | |
| - name: Typecheck | |
| run: bun run typecheck | |
| - name: Build | |
| run: bun run build | |
| - name: Check if version changed | |
| id: version | |
| run: | | |
| LOCAL=$(node -p "require('./package.json').version") | |
| REMOTE=$(npm view @morphllm/opencode-morph-plugin version 2>/dev/null || echo "0.0.0") | |
| echo "local=$LOCAL" >> "$GITHUB_OUTPUT" | |
| echo "remote=$REMOTE" >> "$GITHUB_OUTPUT" | |
| if [ "$LOCAL" != "$REMOTE" ]; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Publish to npm | |
| if: steps.version.outputs.changed == 'true' | |
| run: npm publish --access public | |
| - name: Create GitHub Release | |
| if: steps.version.outputs.changed == 'true' | |
| run: | | |
| VERSION="v${{ steps.version.outputs.local }}" | |
| NOTES=$(awk "/^## \[${VERSION#v}\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md) | |
| NOTES_FILE="${RUNNER_TEMP}/release-notes.md" | |
| echo "$NOTES" > "$NOTES_FILE" | |
| if gh release view "$VERSION" >/dev/null 2>&1; then | |
| gh release edit "$VERSION" --title "$VERSION" --notes-file "$NOTES_FILE" | |
| else | |
| gh release create "$VERSION" --title "$VERSION" --notes-file "$NOTES_FILE" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} |