Add homepage path to config files (#259) #203
This file contains 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: Publish Workflow | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Check if version has been updated | |
id: version_check | |
uses: EndBug/version-check@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node.js | |
if: steps.version_check.outputs.changed == 'true' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.16.1' | |
- name: Install pnpm | |
if: steps.version_check.outputs.changed == 'true' | |
run: npm install -g pnpm | |
- name: Install Dependencies | |
if: steps.version_check.outputs.changed == 'true' | |
run: pnpm install --frozen-lockfile | |
- name: Build and Move Files | |
if: steps.version_check.outputs.changed == 'true' | |
run: | | |
VERSION=v${{steps.version_check.outputs.version}} pnpm build | |
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}" | |
mv schemas/* "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}" | |
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/types" | |
mv types/* "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/types" | |
mkdir -p "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/examples" | |
# Copy JSON files, preserving directory structure | |
rsync -a --prune-empty-dirs --include '*/' --include '*.json' --exclude '*' examples/ "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }}/examples/" | |
# Remove JSON files from source destination | |
find examples -type f -name "*.json" -delete | |
# Copy across new version to maintain a stable reference URL at /latest | |
mkdir -p "$GITHUB_WORKSPACE/latest" | |
cp -r "$GITHUB_WORKSPACE/v${{ steps.version_check.outputs.version }} "$GITHUB_WORKSPACE/latest" | |
- name: Checkout Dist Branch | |
if: steps.version_check.outputs.changed == 'true' | |
run: | | |
git fetch origin dist | |
git checkout -b dist origin/dist | |
- name: Commit and Push Changes | |
if: steps.version_check.outputs.changed == 'true' | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add . | |
git commit -m "Add build files for v${{ steps.version_check.outputs.version }}" | |
git push origin dist | |
- name: Create Release and Tag | |
if: steps.version_check.outputs.changed == 'true' | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ steps.version_check.outputs.version }} | |
release_name: v${{ steps.version_check.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |