add trailing slash for posts routes #319
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: CI/CD | |
on: | |
push: | |
branches: [develop] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get yarn cache directory path | |
id: nestjs-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache dependencies and Next.js build | |
uses: actions/cache@v3 | |
id: nestjs-cache | |
with: | |
path: | | |
${{ steps.nestjs-cache-dir-path.outputs.dir }} | |
${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: ESLint check | |
run: yarn lint | |
- name: Run the tests | |
run: yarn test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Build | |
run: yarn build | |
- name: Generate static files | |
run: yarn export | |
- name: Move 404 page to root directory | |
run: mv ./out/404/index.html ./out/404.html | |
- name: Deploy | |
run: | | |
git config --global user.name $user_name | |
git config --global user.email $user_email | |
git remote set-url origin https://${github_token}@github.com/${repository} | |
yarn deploy | |
env: | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} | |
repository: ${{ github.repository }} | |
- name: Merge gh-pages -> main | |
uses: devmasx/merge-branch@v1.3.1 | |
with: | |
type: now | |
from_branch: gh-pages | |
target_branch: main | |
github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} |