Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Merge pull request #249 from Cloud-Code-AI/248-increase-nav-sidebar-w… #21

Merge pull request #249 from Cloud-Code-AI/248-increase-nav-sidebar-w…

Merge pull request #249 from Cloud-Code-AI/248-increase-nav-sidebar-w… #21

name: Trigger Template Repository Update
on:
push:
branches:
- main
paths:
- 'packages/create-app/package.json'
jobs:
trigger-update:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check-release.outputs.skip }}
permissions:
contents: write
actions: write
steps:
- uses: actions/checkout@v4
- name: Extract Package Version
id: get-version
run: |
VERSION=$(jq -r .version packages/create-app/package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check Latest Release
id: check-release
run: |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name | sed 's/^v//')
CURRENT_VERSION=${{ steps.get-version.outputs.version }}
if [ "$LATEST_RELEASE" == "$CURRENT_VERSION" ]; then
echo "No version change detected. Skipping release."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "New version detected. Proceeding with release."
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Create Release
if: steps.check-release.outputs.skip != 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.get-version.outputs.version }}
name: v${{ steps.get-version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Repository Dispatch
if: steps.check-release.outputs.skip != 'true'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ steps.generate_token.outputs.token }}
repository: ${{ github.repository_owner }}/akiradocs-template
event-type: update-template
client-payload: '{"ref": "${{ github.ref }}","sha": "${{ github.sha }}","version": "${{ steps.get-version.outputs.version }}"}'
publish-npm:
needs: trigger-update
if: needs.trigger-update.outputs.skip != 'true'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
working-directory: packages/create-app
run: |
npm install
npm install -g tsup
- name: Build Package
working-directory: packages/create-app
run: npm run build
- name: Publish to NPM
working-directory: packages/create-app
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}