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:
|
||||
push:
|
||||
@@ -23,19 +23,32 @@ jobs:
|
||||
- name: Checkout
|
||||
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: |
|
||||
apt-get update && apt-get install -y ca-certificates curl tar git
|
||||
curl -fsSL https://zyedidia.github.io/eget.sh | sh
|
||||
./eget cobalt-org/cobalt.rs --to /usr/local/bin/cobalt
|
||||
cobalt --version
|
||||
mkdir -p .ci/tools/bin .ci/tools/wrangler
|
||||
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 \
|
||||
| tar -xzf - -C .ci/tools/bin ./cobalt
|
||||
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
|
||||
run: cobalt build # 出力: ./_site
|
||||
run: .ci/tools/bin/cobalt build # 出力: ./_site
|
||||
|
||||
- name: Deploy to Cloudflare Pages
|
||||
uses: https://github.com/cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ env.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy _site --project-name "${{ env.CF_PAGES_PROJECT }}" --branch "${{ github.ref_name || env.GITEA_REF_NAME || 'main' }}"
|
||||
run: |
|
||||
branch="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-$PROD_BRANCH}}"
|
||||
.ci/tools/wrangler/node_modules/.bin/wrangler pages deploy _site \
|
||||
--project-name "$CF_PAGES_PROJECT" \
|
||||
--branch "$branch"
|
||||
|
||||
Reference in New Issue
Block a user