mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
Add commit hash to version on netlify deployment (#1838)
This commit is contained in:
parent
757f957e0a
commit
eabc941c8f
5 changed files with 16 additions and 38 deletions
|
@ -1,6 +1,6 @@
|
||||||
[build]
|
[build]
|
||||||
publish = ".next"
|
publish = ".next"
|
||||||
command = "bash netlify/build.sh"
|
command = "echo Pseudo build command because the build is made by the CI"
|
||||||
|
|
||||||
[[plugins]]
|
[[plugins]]
|
||||||
package = "@netlify/plugin-nextjs"
|
package = "@netlify/plugin-nextjs"
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/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
|
|
14
netlify/patch-files.sh
Normal file
14
netlify/patch-files.sh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo 'Patch intro.md to include netlify banner.'
|
||||||
|
cp netlify/intro.md public/mock-backend/public/intro.md
|
||||||
|
echo 'Patch motd.txt to include privacy policy.'
|
||||||
|
cp netlify/motd.txt public/mock-backend/public/motd.txt
|
||||||
|
echo 'Patch version.json to include git hash'
|
||||||
|
jq ".version = \"0.0.0+${GITHUB_SHA:0:8}\"" src/version.json > src/_version.json
|
||||||
|
mv src/_version.json src/version.json
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
const { copyFile } = require('fs/promises');
|
|
||||||
|
|
||||||
console.log("Patch intro.md to include netlify banner.")
|
|
||||||
copyFile("netlify/intro.md", "public/mock-backend/public/intro.md")
|
|
||||||
.then(() => console.log("Copied intro.md"))
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(error);
|
|
||||||
process.exit(1);
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log("Patch motd.txt to include privacy policy.")
|
|
||||||
copyFile("netlify/motd.txt", "public/mock-backend/public/motd.txt")
|
|
||||||
.then(() => console.log("Copied motd.txt"))
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(error);
|
|
||||||
process.exit(1);
|
|
||||||
})
|
|
|
@ -4,7 +4,7 @@
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"build:netlify": "node netlify/patch-intro.js && cross-env NEXT_PUBLIC_IGNORE_IFRAME_ORIGIN_CONFIG=true yarn build:mock",
|
"build:netlify": "bash netlify/patch-files.sh && cross-env NEXT_PUBLIC_IGNORE_IFRAME_ORIGIN_CONFIG=true yarn build:mock",
|
||||||
"build:mock": "cross-env NEXT_PUBLIC_USE_MOCK_API=true next build",
|
"build:mock": "cross-env NEXT_PUBLIC_USE_MOCK_API=true next build",
|
||||||
"build:test": "cross-env NEXT_PUBLIC_USE_MOCK_API=true NEXT_PUBLIC_TEST_MODE=true next build",
|
"build:test": "cross-env NEXT_PUBLIC_USE_MOCK_API=true NEXT_PUBLIC_TEST_MODE=true next build",
|
||||||
"analyze": "cross-env ANALYZE=true next build",
|
"analyze": "cross-env ANALYZE=true next build",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue