Skip to content

Commit

Permalink
Different URL prefix for testing and production builds
Browse files Browse the repository at this point in the history
  • Loading branch information
vania-pooh committed Nov 27, 2023
1 parent 35a2de9 commit 3e071ab
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ jobs:
node-version: 14

- name: Build
run: ci/build.sh
run: ci/build.sh latest

- name: Docs
env:
S3_ENDPOINT: ${{ secrets.YC_S3_ENDPOINT }}
S3_BUCKET_NAME: ${{ secrets.YC_S3_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.YC_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.YC_SECRET_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.YC_REGION }}
run: ci/docs.sh latest

- name: Latest image
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ jobs:
with:
node-version: 14

- name: Build
run: ci/build.sh

- name: Prepare release version
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV

- name: Build
run: ci/build.sh $RELEASE_VERSION

- name: Docs
env:
S3_ENDPOINT: ${{ secrets.YC_S3_ENDPOINT }}
S3_BUCKET_NAME: ${{ secrets.YC_S3_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.YC_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.YC_SECRET_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.YC_REGION }}
run: ci/docs.sh $RELEASE_VERSION

- name: Release image
Expand Down
8 changes: 7 additions & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash
set -x
TAG=$1
npm install
npm run build
if [ "$TAG" == "latest" ]; then
npm run build-testing
else
npm run build
fi

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"preview:webpack": "npm run start:webpack",
"prebuild": "rimraf dist",
"build": "npm run build:webpack && npm run build:hugo",
"build-testing": "npm run build-testing:webpack && npm run build:hugo",
"build:preview": "npm run build:webpack && npm run build:hugo:preview",
"build:hugo": "hugo -d ../dist -s site -v",
"build:hugo:preview": "npm run build:hugo -- -D -F",
"build:webpack": "cross-env NODE_ENV=production webpack --config webpack.prod.js --hot --inline"
"build-testing:webpack": "cross-env NODE_ENV=testing webpack --config webpack.prod.js --hot --inline"
},
"author": "",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
{
loader: "sass-loader",
options: {
additionalData: "$prefix: \"" + (process.env.NODE_ENV === "production" ? "/moon" : "") + "\";"
additionalData: "$prefix: \"" + (process.env.NODE_ENV === "production" ? "/moon" : process.env.NODE_ENV === "testing" ? "/unstable/moon" : "") + "\";"
}
}]
}
Expand Down

0 comments on commit 3e071ab

Please sign in to comment.