ci: actions update. #1
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 Next.js app | |
on: | |
push: | |
branches: | |
- master | |
- main | |
paths: | |
- 'pages/**' | |
- 'src/**' | |
- 'next.config.mjs' | |
- 'package.json' | |
- 'package-lock.json' | |
- 'tsconfig.json' | |
- 'tailwind.config.js' | |
- '.github/workflows/deploy.yml' | |
- 'postcss.config.js' | |
- '.eslintrc.json' | |
- '!README.md' | |
- '!LICENSE' | |
- '!.vscode/**' | |
- '!.husky/**' | |
permissions: | |
contents: write | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
# Use lts version of node | |
node-version: 'lts/*' | |
- name: Cache dependencies 📦 | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies with npm 🧶 | |
run: npm install | |
- name: Build and bundle app 📦 | |
run: npm run build | |
- name: Deploy to static branch 🚀 | |
if: github.event_name != 'pull_request' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./out | |
# Do not keep files from the previous run | |
keep_files: false | |
# Deploy to the static branch | |
publish_branch: static |