Merge pull request #83 from Niema-Lab/dependabot/npm_and_yarn/eslint-… #120
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: deploy website | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ['master'] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build site for Playwright and offline mode | |
env: | |
VITE_OFFLINE_VERSION: true | |
run: npm run build | |
- name: Get installed Playwright version | |
id: playwright-version | |
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV | |
- name: Cache Playwright binaries | |
uses: actions/cache@v3 | |
id: playwright-cache | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
- run: npx playwright install --with-deps | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- run: npx playwright install-deps | |
if: steps.playwright-cache.outputs.cache-hit == 'true' | |
- name: Run Playwright deployment tests | |
run: npx playwright test site-tests.spec.ts | |
- name: Push offline mode to master | |
run: | | |
zip -9 -r viralwasm-consensus-offline.zip dist/ run_website.py | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add viralwasm-consensus-offline.zip | |
# Check for changes | |
if git diff-index --quiet HEAD --; then | |
# No changes | |
echo "No changes to commit" | |
else | |
# Changes detected | |
git commit -m "Add offline mode zip" | |
git push origin master | |
fi | |
- name: Build for github pages | |
run: npm run build | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload dist repository | |
path: './dist' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |