mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-15 23:54:42 -04:00
deployments: Fix main branch deployment and overrides (#1801)
* Use different environment per PR Signed-off-by: Erik Michelson <github@erik.michelson.eu> * Fix main deployment by using CI-aware build script Signed-off-by: Erik Michelson <github@erik.michelson.eu> * Use PR title and number in netlify deployment list Signed-off-by: Erik Michelson <github@erik.michelson.eu> * Use exec Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
523701b3d2
commit
6e1847d1e9
4 changed files with 17 additions and 4 deletions
4
.github/workflows/deploy.yml
vendored
4
.github/workflows/deploy.yml
vendored
|
@ -49,14 +49,14 @@ jobs:
|
||||||
with:
|
with:
|
||||||
step: start
|
step: start
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
env: Preview
|
env: "PR #${{ github.event.number }}"
|
||||||
no_override: false
|
no_override: false
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|
||||||
- name: Run netlify CLI deployment
|
- name: Run netlify CLI deployment
|
||||||
env:
|
env:
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
run: bash netlify/deploy.sh "${{ github.event.number }}" "${{ github.head_ref }}"
|
run: bash netlify/deploy.sh "${{ github.event.number }}" "${{ github.head_ref }}" "${{ github.event.pull_request.title }}"
|
||||||
id: netlify-result
|
id: netlify-result
|
||||||
|
|
||||||
- name: Mark GitHub deployment as finished
|
- name: Mark GitHub deployment as finished
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[build]
|
[build]
|
||||||
publish = ".next"
|
publish = ".next"
|
||||||
command = "echo 'Assuming already built and cleaned Next.js app at ./.next/'"
|
command = "bash netlify/build.sh"
|
||||||
|
|
||||||
[[plugins]]
|
[[plugins]]
|
||||||
package = "@netlify/plugin-nextjs"
|
package = "@netlify/plugin-nextjs"
|
||||||
|
|
13
netlify/build.sh
Executable file
13
netlify/build.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
if [[ -z "${GITHUB_ACTIONS}" ]]; then
|
||||||
|
echo "Running in netlify CI or manual"
|
||||||
|
exec yarn build:netlify
|
||||||
|
else
|
||||||
|
echo "Running in GitHub actions CI"
|
||||||
|
echo "Build is not necessary as already done prior to this step."
|
||||||
|
fi
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
deployid="$1-$2"
|
deployid="$1-$2"
|
||||||
|
|
||||||
json=$(yarn netlify deploy --build --context deploy-preview --alias "${deployid}" --json)
|
json=$(yarn netlify deploy --build --context deploy-preview --alias "${deployid}" --json --message "[#$1] $3")
|
||||||
|
|
||||||
url=$(echo "${json}" | jq -r .deploy_url)
|
url=$(echo "${json}" | jq -r .deploy_url)
|
||||||
logs=$(echo "${json}" | jq -r .logs)
|
logs=$(echo "${json}" | jq -r .logs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue