Skip to content

Create Dynamic Template Based on PR Content #6

Create Dynamic Template Based on PR Content

Create Dynamic Template Based on PR Content #6

name: Build Dynamic Template
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
prepyrus_verify:
if: github.repository_owner == 'systemphil'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v4
id: prepyrus-cache-restore
with:
path: target/release/prepyrus_runner
key: ${{ runner.os }}-cargo-${{ hashFiles('scripts/prepyrus_runner/Cargo.lock') }}-${{ hashFiles('scripts/prepyrus_runner/src/**') }}
- name: Install Rust
if: steps.prepyrus-cache-restore.outputs.cache-hit != 'true'
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install dependencies
if: steps.prepyrus-cache-restore.outputs.cache-hit != 'true'
run: cargo build --release --package prepyrus_runner
- name: Run prepyrus script in VERIFY mode
run: target/release/prepyrus_runner absolute_bibliography.bib src/pages verify
- name: Upload prepyrus for next job
uses: actions/upload-artifact@v4
with:
name: prepyrus_artifact
path: target/release/prepyrus_runner
- name: Save Prepyrus to cache
id: prepyrus-cache-save
if: steps.prepyrus-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: target/release/prepyrus_runner
key: ${{ runner.os }}-cargo-${{ hashFiles('scripts/prepyrus_runner/Cargo.lock') }}-${{ hashFiles('scripts/prepyrus_runner/src/**') }}
build_and_deploy:
needs: prepyrus_verify
if: github.repository_owner == 'systemphil'
environment: dev
runs-on: ubuntu-latest
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
SERVICE: ${{ secrets.SERVICE }}
REGION: ${{ secrets.REGION }}
TAG: latest
steps:
- name: Check if running in the parent repository
run: |
if [ "${GITHUB_REPOSITORY}" != "systemphil/sphil" ]; then
echo "This workflow is only intended for the parent repository. Skipping deployment."
exit 1
fi
- name: Checkout Code
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
fetch-depth: 1
- name: Build Dynamic PR Tempalte
uses: luigibertaco/[email protected]
with:
token: "${{ secrets.GITHUB_TOKEN }}"