From a67a57607a29a9c15029e2e795387b19779c0542 Mon Sep 17 00:00:00 2001 From: netpyoung Date: Sun, 24 Dec 2023 01:44:48 +0900 Subject: [PATCH 1/2] add: github action for deploy - https://docs.github.com/en/actions - https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/ --- .github/workflows/deploy.yaml | 69 +++++++++++++++++++++++++++++++++++ resources/public/.nojekyll | 0 2 files changed, 69 insertions(+) create mode 100644 .github/workflows/deploy.yaml create mode 100644 resources/public/.nojekyll diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..cb88b91 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,69 @@ +name: Build and deploy GH Pages + +## ref: https://github.com/marketplace/actions/setup-clojure +## ref: https://github.com/actions/setup-node + +on: + push: + branches: + - deploy + +jobs: + build: + name: Publish site + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + - name: Prepare java + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '8' + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@12.1 + with: + cli: 1.11.1.1413 + - name: Cache clojure dependencies + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository + ~/.gitlibs + ~/.deps.clj + # List all files containing dependencies: + key: cljdeps-${{ hashFiles('deps.edn') }} + # key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }} + # key: cljdeps-${{ hashFiles('project.clj') }} + # key: cljdeps-${{ hashFiles('build.boot') }} + restore-keys: cljdeps- + - name: setup_npm + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - name: build_and_deploy + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + GITHUB_HOSTNAME="github.com" + TARGET_REPOSITORY=${GITHUB_REPOSITORY} + remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@${GITHUB_HOSTNAME}/${TARGET_REPOSITORY}.git" + remote_branch="gh-pages" + + npm install + npm run build + + echo "Pushing artifacts to ${TARGET_REPOSITORY}:$remote_branch" + + cd resources/public + + git init + git config user.name "GitHub Actions" + git config user.email "github-actions-bot@users.noreply.${GITHUB_HOSTNAME}" + git add . + + git commit -m "Deploy ${TARGET_REPOSITORY} to ${TARGET_REPOSITORY}:$remote_branch" + git push --force "${remote_repo}" master:"${remote_branch}" + + echo "Deploy complete" \ No newline at end of file diff --git a/resources/public/.nojekyll b/resources/public/.nojekyll new file mode 100644 index 0000000..e69de29 From 378487f61610a72f2e0227d228cb97bf0ba5abf5 Mon Sep 17 00:00:00 2001 From: netpyoung Date: Sun, 24 Dec 2023 02:03:01 +0900 Subject: [PATCH 2/2] fix: resource url --- resources/public/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/public/index.html b/resources/public/index.html index fcad25d..919f1ce 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -9,8 +9,8 @@ - - + + @@ -27,8 +27,8 @@ - - + + @@ -37,7 +37,7 @@ - +