Skip to content

Workflow file for this run

# Sample workflow for building and deploying a Nuxt site to GitHub Pages
#
# To get started with Nuxt see: https://nuxtjs.org/docs/get-started/installation
#
name: Deploy Nuxt site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ['master']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
run: git clone https://github.com/${{ github.repository }}.git
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_ENV
echo "command=install" >> $GITHUB_ENV
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_ENV
echo "command=ci" >> $GITHUB_ENV
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
run: |
echo "Setup Node"
node -v
npm -v
shell: bash
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build the project
run: ${{ steps.detect-package-manager.outputs.manager }} run build
- name: Generate static files
run: ${{ steps.detect-package-manager.outputs.manager }} run generate
- name: Upload artifact
run: mv ./dist ${{ github.workspace }}/dist
# Deployment job
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
run: git clone https://github.com/${{ github.repository }}.git
- name: Deploy to GitHub Pages
run: |
cd cozy-house
git checkout gh-pages
git rm -r .
cp -a ../dist/. .
git add .
git commit -m "Deploying to gh-pages"
git push origin gh-pages