Skip to content

Merge branch 'main' of https://github.com/akadeepesh/BioSignal-Record… #3

Merge branch 'main' of https://github.com/akadeepesh/BioSignal-Record…

Merge branch 'main' of https://github.com/akadeepesh/BioSignal-Record… #3

Workflow file for this run

name: Deploy BioSignal Recorder Web
on:
push:
branches: ["main", "version1.0"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect project type
id: detect-project
run: |
if [ -f "${{ github.workspace }}/next.config.js" ]; then
echo "type=nextjs" >> $GITHUB_OUTPUT
else
echo "type=static" >> $GITHUB_OUTPUT
fi
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
else
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Setup Pages
uses: actions/configure-pages@v5
with:
static_site_generator: ${{ steps.detect-project.outputs.type == 'nextjs' && 'next' || 'static' }}
- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
key: ${{ runner.os }}-${{ steps.detect-project.outputs.type }}-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-${{ steps.detect-project.outputs.type }}-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build project
run: |
if [ "${{ steps.detect-project.outputs.type }}" = "nextjs" ]; then
${{ steps.detect-package-manager.outputs.runner }} next build
else
${{ steps.detect-package-manager.outputs.runner }} run build
fi
env:
NEXT_PUBLIC_BASE_PATH: ${{ format('/BioSignal-Recorder-Web{0}', github.ref == 'refs/heads/main' && '' || format('/{0}', github.ref_name)) }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ steps.detect-project.outputs.type == 'nextjs' && './out' || './build' }}
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