-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17c1764
commit d409e83
Showing
5 changed files
with
359 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Build and deploy via gh-pages branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 'lts/*' | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Check and prepare homepage URL | ||
id: check | ||
run: | | ||
HOMEPAGE=$(node -p "require('./package.json').homepage") | ||
STRIPPED_HOMEPAGE=${HOMEPAGE#http://} | ||
STRIPPED_HOMEPAGE=${STRIPPED_HOMEPAGE#https://} | ||
echo "::set-output name=stripped_homepage::$STRIPPED_HOMEPAGE" | ||
if [[ ${HOMEPAGE: -10} != ".github.io" ]]; then | ||
echo "::set-output name=run_cname::true" | ||
else | ||
echo "::set-output name=run_cname::false" | ||
fi | ||
- name: Set CNAME | ||
if: steps.check.outputs.run_cname == 'true' | ||
run: echo ${{ steps.check.outputs.stripped_homepage }} > ./dist/CNAME | ||
|
||
- name: Deploy | ||
run: npm run deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ node_modules | |
dist | ||
dist-ssr | ||
*.local | ||
.github | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.