Skip to content

edit to deploy to dev #3

edit to deploy to dev

edit to deploy to dev #3

Workflow file for this run

name: Deploy Dev Preview
on:
push:
branches: [dev]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Add noindex meta tag
run: |
sed -i 's/<head>/<head>\n <meta name="robots" content="noindex, nofollow">/' dist/index.html
- name: Use dev robots.txt
run: |
cp public/robots-dev.txt dist/robots.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: github-pages
path: dist
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: github-pages
path: dist
- name: Unzip artifact
run: |
cd dist
tar -xf artifact.tar
rm artifact.tar
- 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 main:gh-pages
# Clean up credentials
rm ~/.git-credentials