Search #16
Workflow file for this run
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: Build and Deploy Static Site | |
on: | |
push: | |
branches: | |
- main | |
# paths: | |
# - "apps/iiif/**" | |
# - "turbo.json" | |
# - ".github/workflows/static-site.yml" | |
pull_request: | |
# paths: | |
# - "apps/static-site/**" | |
# - "turbo.json" | |
# - ".github/workflows/static-site.yml" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup bun.sh environment | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Cache buns dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.bun/install/cache | |
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-bun- | |
- name: Run bun install | |
run: bun install --frozen-lockfile | |
- name: Cache .iiif/cache | |
uses: actions/cache@v4 | |
with: | |
path: apps/iiif/.iiif/cache | |
key: ${{ runner.os }}-iiif-cache-${{ hashFiles('apps/iiif/.iiifrc.yml') }} | |
restore-keys: | | |
${{ runner.os }}-iiif-cache- | |
## Build and deploy IIIF first. | |
# - name: Run bun build | |
# run: bun run build --filter=iiif | |
- name: Netlify deploy (preview) | |
id: netlify-preview | |
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-preview')) | |
working-directory: apps/iiif | |
run: | | |
netlify deploy \ | |
--build \ | |
--alias=deploy-preview-${{ github.event.number }} \ | |
--filter=iiif \ | |
--json \ | |
--dir=apps/iiif/.next/ > deploy_output.txt | |
output=$(cat deploy_output.txt) | |
echo "NETLIFY_OUTPUT=$output" >> "$GITHUB_OUTPUT" | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_IIIF_SITE_ID }} | |
IIIF_PREVIEW_URL: https://deploy-preview-${{ github.event.number }}--delft-iiif.netlify.app | |
- name: Parse NETLIFY_OUTPUT JSON | |
run: | | |
echo "The URL where the logs from the deploy can be found" | |
echo "${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).logs }}" | |
echo "" | |
echo "the URL of the draft site that Netlify provides" | |
echo "${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).deploy_url }}" | |
echo "" | |
echo "the URL of the "real" site, set only if `--prod` was passed" | |
echo "${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).url }}" | |
# - name: Run bun build | |
# run: bun run build --filter=static-site | |
# - name: Deploy to Netlify | |
# if: github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-preview')) | |
# uses: nwtgck/[email protected] | |
# with: | |
# publish-dir: "./apps/static-site/.next/" | |
# production-branch: main | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# # netlify-config-path: "./apps/static-site/netlify.toml" | |
# deploy-message: "Deploy from GitHub Actions" | |
# github-deployment-environment: "heritage.tudelft.nl" | |
# alias: deploy-preview-${{ github.event.number }} | |
# enable-commit-comment: ${{ github.event_name == 'pull_request' }} | |
# overwrites-pull-request-comment: true | |
# env: | |
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
# timeout-minutes: 1 |