2022-01-25 10:10:34 -05:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
name: deploy
|
|
|
|
|
|
|
|
on:
|
2022-02-06 08:23:15 -05:00
|
|
|
push:
|
|
|
|
branches: [ main ]
|
2022-01-25 10:10:34 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Deploys to netlify
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2022-03-05 10:27:37 -05:00
|
|
|
uses: actions/checkout@v3
|
2022-01-25 10:10:34 -05:00
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
|
|
|
|
|
|
|
- name: Cache yarn cache
|
2022-04-02 05:07:13 -04:00
|
|
|
uses: actions/cache@v3
|
2022-01-25 10:10:34 -05:00
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
2022-06-15 14:40:26 -04:00
|
|
|
key: ${{ runner.os }}-18-yarn-${{ hashFiles('**/yarn.lock') }}
|
2022-01-25 10:10:34 -05:00
|
|
|
restore-keys: |
|
2022-06-15 14:40:26 -04:00
|
|
|
${{ runner.os }}-yarn-18
|
2022-01-25 10:10:34 -05:00
|
|
|
|
|
|
|
- name: Set up NodeJS
|
2022-02-25 19:36:32 -05:00
|
|
|
uses: actions/setup-node@v3
|
2022-01-25 10:10:34 -05:00
|
|
|
with:
|
2022-06-15 14:40:26 -04:00
|
|
|
node-version: 18
|
2022-01-25 10:10:34 -05:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install --immutable
|
|
|
|
|
|
|
|
- name: Build netlify variant
|
|
|
|
run: yarn build:netlify
|
|
|
|
|
|
|
|
- name: Remove Next.js cache to avoid it being deployed
|
|
|
|
run: rm -r .next/cache
|
|
|
|
|
|
|
|
- name: Run netlify CLI deployment
|
|
|
|
env:
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
2022-02-06 08:23:15 -05:00
|
|
|
run: bash netlify/deploy-main.sh "${{ github.event.head_commit.id }}" "${{ github.event.head_commit.message }}"
|