mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-25 15:21:14 +00:00
7320fe2ac1
This is an import of 166ca8da12
with some changes to make it fit into the mono repo.
- TypedEventEmitter has been replaced with EventEmitter2 because EventEmitter2 is faster and TypedEventEmitter had some troubles with the new way of compiling.
- tsc-esm has been replaced with microbundle. The problems that lib0 doesn't export its types correctly has been solved using yarn patch.
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
94 lines
2.8 KiB
YAML
94 lines
2.8 KiB
YAML
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
name: Frontend / Deploy develop branch to Netlify
|
|
|
|
on:
|
|
push:
|
|
branches: [ develop ]
|
|
|
|
env:
|
|
NETLIFY_VERSION: 12.0.11
|
|
NODE_VERSION: 18
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: frontend
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
name: Check for frontend changes
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: read
|
|
outputs:
|
|
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
if: github.event_name != 'push'
|
|
|
|
- name: Check for frontend file changes
|
|
if: github.event_name != 'push'
|
|
uses: dorny/paths-filter@v2
|
|
id: changed
|
|
with:
|
|
filters: |
|
|
files:
|
|
- 'commons/**'
|
|
- 'frontend/**'
|
|
- '.github/**'
|
|
- '.yarn/**'
|
|
|
|
deploy:
|
|
needs: changes
|
|
runs-on: ubuntu-latest
|
|
name: Deploys to netlify
|
|
steps:
|
|
- name: Checkout repository
|
|
if: needs.changes.outputs.changed == 'true'
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup node
|
|
if: needs.changes.outputs.changed == 'true'
|
|
uses: ./.github/actions/setup-node
|
|
with:
|
|
NODE_VERSION: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Patch intro.md to include netlify banner.
|
|
if: needs.changes.outputs.changed == 'true'
|
|
run: cp netlify/intro.md public/public/intro.md
|
|
|
|
- name: Patch motd.md to include privacy policy.
|
|
if: needs.changes.outputs.changed == 'true'
|
|
run: cp netlify/motd.md public/public/motd.md
|
|
|
|
- name: Patch version.json to include git hash
|
|
if: needs.changes.outputs.changed == 'true'
|
|
run: jq ".version = \"0.0.0+${GITHUB_SHA:0:8}\"" src/version.json > src/_version.json && mv src/_version.json src/version.json
|
|
|
|
- name: Patch base URL
|
|
if: needs.changes.outputs.changed == 'true'
|
|
run: echo "HD_EDITOR_BASE_URL=\"https://hedgedoc.dev/\"" >> .env.production
|
|
|
|
- name: Build app
|
|
if: needs.changes.outputs.changed == 'true'
|
|
run: yarn build:mock
|
|
|
|
- name: Remove Next.js cache to avoid it being deployed
|
|
if: needs.changes.outputs.changed == 'true'
|
|
run: rm -r .next/cache
|
|
|
|
- name: Install netlify CLI
|
|
if: needs.changes.outputs.changed == 'true'
|
|
run: "npm install -g netlify-cli@${{ env.NETLIFY_VERSION }}"
|
|
|
|
- name: Run netlify CLI deployment
|
|
if: needs.changes.outputs.changed == 'true'
|
|
env:
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
run: "netlify deploy --build --prod --message \"${{ github.event.head_commit.id }}: ${{ github.event.head_commit.message }}\""
|