From fd1a01c7c6e2d6046bf1349157cac41d8d58f2c2 Mon Sep 17 00:00:00 2001 From: saamturner <157153031+saamturner@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:25:06 -0600 Subject: [PATCH] Initial commit --- .github/workflows/deploy-main.yml | 97 +++++++++++++++++++++++++++++++ .gitignore | 1 + README.md | 3 + data/annotations/.gitkeep | 0 data/events/.gitkeep | 0 data/pages/.gitkeep | 0 data/pages/order.json | 1 + data/project.json | 21 +++++++ data/vtt/.gitkeep | 0 9 files changed, 123 insertions(+) create mode 100644 .github/workflows/deploy-main.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 data/annotations/.gitkeep create mode 100644 data/events/.gitkeep create mode 100644 data/pages/.gitkeep create mode 100644 data/pages/order.json create mode 100644 data/project.json create mode 100644 data/vtt/.gitkeep diff --git a/.github/workflows/deploy-main.yml b/.github/workflows/deploy-main.yml new file mode 100644 index 0000000..1b7a1bf --- /dev/null +++ b/.github/workflows/deploy-main.yml @@ -0,0 +1,97 @@ +name: Deploy main branch to GitHub Pages + +on: + # Trigger the workflow every time you push to the `main` branch + # Using a different branch name? Replace `main` with your branch’s name + push: + branches: [main] + # Allows you to run this workflow manually from the Actions tab on GitHub. + workflow_dispatch: + +# Allow this job to clone the repo and create a page deployment +permissions: + contents: write + pages: write + id-token: write + +jobs: + checkout-build-deploy: + runs-on: ubuntu-latest + concurrency: + group: deploy-to-main-group + cancel-in-progress: true + steps: + - name: Checkout project repository + uses: actions/checkout@v4 + + - name: Read in the project file + id: project + uses: antifree/json-to-variables@v1.0.1 + with: + filename: ./data/project.json + prefix: project + + - name: Checkout project-client + uses: actions/checkout@v4 + with: + repository: AVAnnotate/project-client + path: "./client" + ref: ${{vars.PROJECT_CLIENT_BRANCH || 'main'}} + + - name: npm install + working-directory: "./client" + run: npm install + + - name: Ensure a content directory + run: mkdir -p "./client/src/content" + + - name: Copy data to content directory + run: cp -r ./data/* ./client/src/content + + - name: Make a project directory if it does not exist + run: mkdir -p "./client/src/content/project" + + - name: Move project.json file to project directory + run: mv ./client/src/content/project.json ./client/src/content/project/project.json + + - name: Copy any VTT files to public + run: cp -r ./data/vtt/. ./client/public/ + + # Only publish when directed + - name: Setup Pages + if: ${{ env.project_publish_publish_pages_app == 'true' }} + id: pages + uses: actions/configure-pages@v5 + + - name: Make a manifests directory if it does not exist + run: mkdir -p "./client/src/content/manifests" + + - name: Generate manifest + run: npx tsx ./client/generate-iiif-3-manifests.ts -d './data' -u "https://${{ github.repository_owner }}.github.io/${{ env.project_project_slug}}" -s 'false' + + - name: Build Astro Client + uses: withastro/action@v2 + with: + path: "./client" + + - name: Deploy to GitHub Pages + if: ${{ env.project_publish_publish_pages_app == 'true' }} + id: deployment + uses: actions/deploy-pages@v4 + env: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + - name: Create an offline site + if: ${{ env.project_publish_publish_pages_app != 'true' }} + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + rm -rf ./site + mv ./client/dist ./site + cp ./client/static-site-readme.md ./site/README.md + git config user.email "gitbot@avannotate.com" + git config user.name "GitHub Action Bot" + git add ./site + git diff-index --quiet HEAD || git commit -m 'Created offline site' + git push diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed78bf8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/client \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f37ba47 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# AVAnnotate Project Template + +This repository contains the template used to bootstrap new ANAnnotate Projects. diff --git a/data/annotations/.gitkeep b/data/annotations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/events/.gitkeep b/data/events/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/pages/.gitkeep b/data/pages/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/pages/order.json b/data/pages/order.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/data/pages/order.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/data/project.json b/data/project.json new file mode 100644 index 0000000..c7f3dad --- /dev/null +++ b/data/project.json @@ -0,0 +1,21 @@ +{ + "users": [], + "publish": { + "publishPagesApp": false, + "publishSHA": "", + "publishISODate": "" + }, + "project": { + "title": "Zora Neale Hurston’s Works Progress Administration Recordings", + "description": "", + "language": "", + "slug": "", + "authors": "", + "mediaPlayer": "universal", + "autoPopulateHomePage": "true", + "additionalUsers": [], + "": {}, + "createdAt": "", + "updatedAt": "" + } +} \ No newline at end of file diff --git a/data/vtt/.gitkeep b/data/vtt/.gitkeep new file mode 100644 index 0000000..e69de29