mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-03-12 17:51:53 +08:00
58 lines
1.5 KiB
YAML
58 lines
1.5 KiB
YAML
name: Sync Repo to Database
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
roadmap_slug:
|
|
description: "The slug of the roadmap to sync (e.g., frontend, backend)"
|
|
required: true
|
|
|
|
jobs:
|
|
sync-roadmap:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup pnpm@v9
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
run_install: false
|
|
|
|
- name: Setup Node.js Version 20 (LTS)
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
|
|
- name: Get all roadmap files
|
|
id: roadmap-files
|
|
run: |
|
|
ROADMAP_DIR="src/data/roadmaps/${{ inputs.roadmap_slug }}"
|
|
|
|
if [ ! -d "$ROADMAP_DIR" ]; then
|
|
echo "Error: Roadmap directory '$ROADMAP_DIR' does not exist"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Getting all files in $ROADMAP_DIR"
|
|
|
|
ALL_FILES=$(find "$ROADMAP_DIR" -type f | tr '\n' ',')
|
|
|
|
echo "Files to sync:"
|
|
echo "$ALL_FILES"
|
|
|
|
echo "files=$ALL_FILES" >> $GITHUB_OUTPUT
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
echo "Installing Dependencies"
|
|
pnpm install
|
|
|
|
- name: Run sync script
|
|
run: |
|
|
echo "Running sync script for roadmap: ${{ inputs.roadmap_slug }}"
|
|
echo "Files: ${{ steps.roadmap-files.outputs.files }}"
|
|
|
|
npm run sync:repo-to-database -- --files="${{ steps.roadmap-files.outputs.files }}" --secret=${{ secrets.GH_SYNC_SECRET }}
|