ci: cache cobalt and wrangler tools
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Deploy to Cloudflare Pages (cobalt, wrangler-action)
|
name: Deploy to Cloudflare Pages (cobalt, wrangler)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -23,19 +23,32 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: Install cobalt (prebuilt)
|
- name: Restore build tools
|
||||||
|
id: build-tools
|
||||||
|
uses: https://github.com/actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: .ci/tools
|
||||||
|
key: blog-tools-linux-x64-cobalt-v0.20.4-wrangler-v3.90.0
|
||||||
|
|
||||||
|
- name: Install build tools
|
||||||
|
if: steps.build-tools.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
apt-get update && apt-get install -y ca-certificates curl tar git
|
mkdir -p .ci/tools/bin .ci/tools/wrangler
|
||||||
curl -fsSL https://zyedidia.github.io/eget.sh | sh
|
curl -fsSL https://github.com/cobalt-org/cobalt.rs/releases/download/v0.20.4/cobalt-v0.20.4-x86_64-unknown-linux-gnu.tar.gz \
|
||||||
./eget cobalt-org/cobalt.rs --to /usr/local/bin/cobalt
|
| tar -xzf - -C .ci/tools/bin ./cobalt
|
||||||
cobalt --version
|
npm install --prefix .ci/tools/wrangler --no-audit --no-fund --no-package-lock --no-save [email protected]
|
||||||
|
|
||||||
|
- name: Check build tools
|
||||||
|
run: |
|
||||||
|
.ci/tools/bin/cobalt --version
|
||||||
|
.ci/tools/wrangler/node_modules/.bin/wrangler --version
|
||||||
|
|
||||||
- name: Build site with cobalt
|
- name: Build site with cobalt
|
||||||
run: cobalt build # 出力: ./_site
|
run: .ci/tools/bin/cobalt build # 出力: ./_site
|
||||||
|
|
||||||
- name: Deploy to Cloudflare Pages
|
- name: Deploy to Cloudflare Pages
|
||||||
uses: https://github.com/cloudflare/wrangler-action@v3
|
run: |
|
||||||
with:
|
branch="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-$PROD_BRANCH}}"
|
||||||
apiToken: ${{ env.CLOUDFLARE_API_TOKEN }}
|
.ci/tools/wrangler/node_modules/.bin/wrangler pages deploy _site \
|
||||||
accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }}
|
--project-name "$CF_PAGES_PROJECT" \
|
||||||
command: pages deploy _site --project-name "${{ env.CF_PAGES_PROJECT }}" --branch "${{ github.ref_name || env.GITEA_REF_NAME || 'main' }}"
|
--branch "$branch"
|
||||||
|
|||||||
Reference in New Issue
Block a user