2022-01-25 10:10:34 -05:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-11-11 04:55:08 -05:00
|
|
|
name: Frontend / Deploy develop branch to Netlify
|
2022-01-25 10:10:34 -05:00
|
|
|
|
|
|
|
on:
|
2022-02-06 08:23:15 -05:00
|
|
|
push:
|
2022-11-11 04:55:08 -05:00
|
|
|
branches: [ develop ]
|
2022-01-25 10:10:34 -05:00
|
|
|
|
2022-10-21 12:57:29 -04:00
|
|
|
env:
|
2023-04-13 09:44:36 -04:00
|
|
|
NETLIFY_VERSION: 13.2.2
|
2023-04-13 09:32:40 -04:00
|
|
|
NETLIFY_NEXTJS_PLUGIN_VERSION: 4.33.0
|
2023-05-09 05:38:02 -04:00
|
|
|
NODEJS_VERSION: 20
|
2022-10-21 12:57:29 -04:00
|
|
|
|
2022-11-11 04:55:08 -05:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: frontend
|
|
|
|
|
|
|
|
concurrency:
|
2022-12-05 12:40:59 -05:00
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
2022-11-11 04:55:08 -05:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-01-25 10:10:34 -05:00
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Deploys to netlify
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-06-09 11:13:45 -04:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2022-01-25 10:10:34 -05:00
|
|
|
|
2022-11-29 11:36:57 -05:00
|
|
|
- name: Setup node
|
|
|
|
uses: ./.github/actions/setup-node
|
2022-01-25 10:10:34 -05:00
|
|
|
with:
|
2022-12-11 18:46:30 -05:00
|
|
|
NODEJS_VERSION: ${{ env.NODEJS_VERSION }}
|
2022-10-21 12:57:29 -04:00
|
|
|
|
|
|
|
- name: Patch intro.md to include netlify banner.
|
|
|
|
run: cp netlify/intro.md public/public/intro.md
|
|
|
|
|
|
|
|
- name: Patch motd.md to include privacy policy.
|
|
|
|
run: cp netlify/motd.md public/public/motd.md
|
2022-01-25 10:10:34 -05:00
|
|
|
|
2022-10-21 12:57:29 -04:00
|
|
|
- name: Patch base URL
|
2023-02-05 03:31:33 -05:00
|
|
|
run: echo "HD_BASE_URL=\"https://hedgedoc.dev/\"" >> .env.production
|
2022-07-30 18:39:49 -04:00
|
|
|
|
2022-09-18 14:12:51 -04:00
|
|
|
- name: Build app
|
2022-12-11 18:46:30 -05:00
|
|
|
run: yarn turbo run build --filter=frontend
|
|
|
|
shell: bash
|
|
|
|
working-directory: .
|
|
|
|
env:
|
|
|
|
NEXT_PUBLIC_USE_MOCK_API: true
|
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API: ${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
2022-01-25 10:10:34 -05:00
|
|
|
|
|
|
|
- name: Remove Next.js cache to avoid it being deployed
|
|
|
|
run: rm -r .next/cache
|
|
|
|
|
2022-10-21 12:57:29 -04:00
|
|
|
- name: Install netlify CLI
|
2023-04-13 09:32:40 -04:00
|
|
|
run: "yarn add --dev netlify-cli@${{ env.NETLIFY_VERSION }} @netlify/plugin-nextjs@${{ env.NETLIFY_NEXTJS_PLUGIN_VERSION }}"
|
2022-10-21 12:57:29 -04:00
|
|
|
|
2022-01-25 10:10:34 -05:00
|
|
|
- name: Run netlify CLI deployment
|
|
|
|
env:
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
2023-07-03 05:26:11 -04:00
|
|
|
run: "netlify deploy --build --prod --message \"${{ github.event.head_commit.id }}\""
|