Merge pull request #1 from netpyoung/translate-kr #1
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
name: Build and deploy GH Pages | |
## ref: https://github.com/marketplace/actions/setup-clojure | |
## ref: https://github.com/actions/setup-node | |
on: | |
push: | |
branches: | |
- translate-kr | |
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/[email protected] | |
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 "[email protected].${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" |