2024-03-09 15:23:59 +08:00
|
|
|
name: Build & Depoly
|
|
|
|
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
depoly:
|
|
|
|
runs-on: docker
|
2024-03-09 17:43:32 +08:00
|
|
|
container:
|
2024-03-09 19:14:52 +08:00
|
|
|
image: node:20-bullseye
|
2024-03-09 15:23:59 +08:00
|
|
|
name: Depoly blog
|
|
|
|
steps:
|
2024-06-07 02:22:44 +00:00
|
|
|
- name: Install git-lfs
|
|
|
|
run: apt update -y && apt install -y git-lfs
|
2024-03-09 15:23:59 +08:00
|
|
|
- name: Checkout
|
2024-03-09 19:14:52 +08:00
|
|
|
uses: actions/checkout@v4
|
2024-03-09 15:23:59 +08:00
|
|
|
with:
|
|
|
|
submodules: true # Checkout private submodules(themes or something else).
|
2024-06-07 05:42:11 +00:00
|
|
|
- name: Checkout LFS
|
|
|
|
run: |
|
2024-06-07 05:39:27 +00:00
|
|
|
UrlBase=$GITHUB_SERVER_URL; \
|
|
|
|
UrlLfsBase=$UrlBase/${{ github.repository }}.git/info/lfs/objects; \
|
|
|
|
Auth=`/usr/bin/git config --get --local http.$UrlBase/.extraheader`; \
|
|
|
|
/usr/bin/git config --local http.${UrlLfsBase}/batch.extraheader "$Auth"; \
|
|
|
|
/usr/bin/git config --local http.${UrlLfsBase}/.extraheader ''
|
|
|
|
|
|
|
|
git config --local lfs.transfer.maxretries 1
|
|
|
|
|
|
|
|
git lfs fetch origin refs/remotes/origin/${{ github.ref_name }}
|
|
|
|
git lfs checkout
|
2024-03-09 15:23:59 +08:00
|
|
|
|
2025-04-11 21:50:48 +08:00
|
|
|
- name: Setup Bun
|
|
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
with:
|
|
|
|
bun-version-file: "package.json"
|
2024-03-09 15:23:59 +08:00
|
|
|
|
|
|
|
- name: Cache Dependencies
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
2025-04-11 21:50:48 +08:00
|
|
|
path: ~/.bun/install/cache
|
|
|
|
key: ${{ runner.os }}-${{ matrix.bun }}-bun-${{ hashFiles('**/bun.lockb') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.bun }}-bun-
|
2024-03-09 15:23:59 +08:00
|
|
|
|
|
|
|
- name: Install Dependencies
|
2025-04-11 21:50:48 +08:00
|
|
|
run: bun install
|
2024-03-09 15:23:59 +08:00
|
|
|
|
|
|
|
- name: Build Website
|
2025-04-11 21:50:48 +08:00
|
|
|
run: bun dist
|
2024-03-09 15:23:59 +08:00
|
|
|
|
|
|
|
- name: Depoly Website
|
|
|
|
uses: https://github.com/cloudflare/wrangler-action@v3
|
|
|
|
with:
|
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
2025-04-11 21:50:48 +08:00
|
|
|
command: pages deploy --project-name=rubicons-blog dist
|