diff --git a/.github/actions/prepare-site/action.yml b/.github/actions/prepare-site/action.yml new file mode 100644 index 0000000..678851d --- /dev/null +++ b/.github/actions/prepare-site/action.yml @@ -0,0 +1,50 @@ +name: Prepare Site +description: Prepare external content collections and synced spreadsheet data for the website build. + +runs: + using: composite + steps: + - name: Remove local debug collections + shell: bash + run: | + rm -rf src/collection_people + rm -rf src/collection_projects + rm -rf src/collection_news + + - name: Clone marc_people repository + uses: actions/checkout@v5 + with: + repository: pdnMARC/marc_people + path: src/collection_people + fetch-depth: 1 + + - name: Clone marc_projects repository + uses: actions/checkout@v5 + with: + repository: pdnMARC/marc_projects + path: src/collection_projects + fetch-depth: 1 + + - name: Clone marc_news repository + uses: actions/checkout@v5 + with: + repository: pdnMARC/marc_news + path: src/collection_news + fetch-depth: 1 + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install uv + shell: bash + run: pip install uv + + - name: Sync Python dependencies + shell: bash + run: uv sync --frozen + + - name: Run Python scripts + shell: bash + run: uv run python_scripts/get_data.py diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 78717fc..3d0777c 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -17,76 +17,17 @@ jobs: runs-on: ubuntu-latest steps: - # Checkout main Astro repo - name: Checkout main repository uses: actions/checkout@v5 - # 👇 Add the logging step here - name: Print trigger info run: echo "Triggered by ${{ github.event.client_payload.source }}" - # Remove local debug collection - - name: Remove local debug collections - run: | - rm -rf src/collection_people - rm -rf src/collection_projects - rm -rf src/collection_news + - name: Prepare site inputs + uses: ./.github/actions/prepare-site - # Clone marc_people into the correct location - - name: Clone marc_people repository - uses: actions/checkout@v5 - with: - repository: pdnMARC/marc_people - path: src/collection_people - fetch-depth: 1 - # If marc_people is private: - # token: ${{ secrets.MARC_PEOPLE_READ_TOKEN }} - - # Clone marc_projects into the correct location - - name: Clone marc_projects repository - uses: actions/checkout@v5 - with: - repository: pdnMARC/marc_projects - path: src/collection_projects - fetch-depth: 1 - # If marc_people is private: - # token: ${{ secrets.MARC_PEOPLE_READ_TOKEN }} - - # Clone marc_news into the correct location - - name: Clone marc_news repository - uses: actions/checkout@v5 - with: - repository: pdnMARC/marc_news - path: src/collection_news - fetch-depth: 1 - # If marc_news is private: - # token: ${{ secrets.MARC_NEWS_READ_TOKEN }} - - # ----------------------------- - # 🐍 Python Setup using uv - # ----------------------------- - - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install uv - run: pip install uv - - - name: Sync Python dependencies - run: uv sync --frozen - - - name: Run Python scripts - run: uv run python_scripts/get_data.py - - - # Install, build, and upload - name: Install, build, and upload your site uses: withastro/action@v5 - # with: - # node-version: 22 - # package-manager: pnpm@latest deploy: needs: build @@ -94,6 +35,7 @@ jobs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} + steps: - name: Deploy to GitHub Pages id: deployment diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 0000000..1ac2ef0 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,31 @@ +name: PR Build Check + +on: + pull_request: + branches: [ main ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout main repository + uses: actions/checkout@v5 + + - name: Prepare site inputs + uses: ./.github/actions/prepare-site + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build site + run: npm run build