diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index fc6efd4..8325987 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -3,6 +3,7 @@ name: Deploy Dev Preview on: push: branches: [dev] + workflow_dispatch: permissions: contents: read @@ -41,17 +42,38 @@ jobs: cp public/robots-dev.txt dist/robots.txt - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: github-pages path: dist deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: github-pages + path: dist + + - name: Deploy to Preview Repo + env: + PREVIEW_TOKEN: ${{ secrets.PREVIEW_REPO_TOKEN }} + run: | + cd dist + git init + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Configure git credentials securely + git config credential.helper store + echo "https://x-access-token:${PREVIEW_TOKEN}@github.com" > ~/.git-credentials + + git add . + git commit -m "Deploy preview from ${{ github.sha }}" + git remote add origin https://github.com/medical-informatics-platform/mip-website-preview.git + git push -f origin HEAD:gh-pages + + # Clean up credentials + rm ~/.git-credentials diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 0dd081b..3dff7e9 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -4,6 +4,7 @@ on: push: tags: - 'v*' + workflow_dispatch: permissions: contents: read diff --git a/index.html b/index.html index 06428a9..ab30f1c 100644 --- a/index.html +++ b/index.html @@ -154,7 +154,7 @@ - + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 2647751..e1a61e2 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import { marked } from 'marked' // Fetch and render Federations async function loadFederations() { try { - const response = await fetch('/content/federations.json'); + const response = await fetch('content/federations.json'); const federations = await response.json(); const grid = document.getElementById('federations-grid'); @@ -31,7 +31,7 @@ async function loadFederations() { // Fetch and render Documentation text async function loadDocumentation() { try { - const response = await fetch('/content/documentation.md'); + const response = await fetch('content/documentation.md'); const text = await response.text(); const docContainer = document.getElementById('doc-text');