mirror of
https://github.com/SukkaW/Surge.git
synced 2026-09-13 02:54:38 +08:00
CI: parallel deloy job even more
This commit is contained in:
40
.github/workflows/main.yml
vendored
40
.github/workflows/main.yml
vendored
@@ -174,11 +174,22 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
WRANGLER_VERSION: "3.114.17"
|
WRANGLER_VERSION: "3.114.17"
|
||||||
steps:
|
steps:
|
||||||
|
# Download the artifact in the background while the npm cache path is queried
|
||||||
|
- uses: actions/download-artifact@v8
|
||||||
|
id: download_build_artifact
|
||||||
|
background: true
|
||||||
|
with:
|
||||||
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
||||||
|
path: public
|
||||||
- name: Get NPM cache directory path
|
- name: Get NPM cache directory path
|
||||||
id: npm_cache_path
|
id: npm_cache_path
|
||||||
shell: sh
|
shell: sh
|
||||||
run: echo dir=$(npm config get cache) >> $GITHUB_OUTPUT
|
run: echo dir=$(npm config get cache) >> $GITHUB_OUTPUT
|
||||||
- uses: actions/cache@v6
|
# Only the Cloudflare deploy needs this cache, restore in background
|
||||||
|
- name: Wrangler CLI npm cache
|
||||||
|
id: wrangler_npm_cache
|
||||||
|
uses: actions/cache@v6
|
||||||
|
background: true
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
${{ steps.npm_cache_path.outputs.dir }}
|
${{ steps.npm_cache_path.outputs.dir }}
|
||||||
@@ -186,29 +197,18 @@ jobs:
|
|||||||
key: deploy-to-cloudflare-npm-${{ runner.os }}-${{ runner.arch }}-wrangler-${{ env.WRANGLER_VERSION }}
|
key: deploy-to-cloudflare-npm-${{ runner.os }}-${{ runner.arch }}-wrangler-${{ env.WRANGLER_VERSION }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
deploy-to-cloudflare-npm-${{ runner.os }}-${{ runner.arch }}-wrangler-
|
deploy-to-cloudflare-npm-${{ runner.os }}-${{ runner.arch }}-wrangler-
|
||||||
- uses: actions/download-artifact@v8
|
|
||||||
with:
|
|
||||||
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
|
||||||
path: public
|
|
||||||
- name: Prepare GitHub Pages deployment marker
|
- name: Prepare GitHub Pages deployment marker
|
||||||
id: deploy_marker
|
id: deploy_marker
|
||||||
run: |
|
run: |
|
||||||
echo "marker_content=${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
|
echo "marker_content=${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
|
||||||
|
# Wait for the artifact to be downloaded before deploying
|
||||||
|
- wait: download_build_artifact
|
||||||
- name: Remove build artifact
|
- name: Remove build artifact
|
||||||
uses: geekyeggo/delete-artifact@v6
|
uses: geekyeggo/delete-artifact@v6
|
||||||
background: true
|
background: true
|
||||||
with:
|
with:
|
||||||
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
||||||
# Deploy to Cloudflare, GitLab, and GitHub in parallel
|
# Deploy to Cloudflare, GitLab, and GitHub in parallel
|
||||||
- name: Deploy to Cloudflare Pages
|
|
||||||
id: deploy_cloudflare
|
|
||||||
uses: cloudflare/wrangler-action@v3
|
|
||||||
background: true
|
|
||||||
with:
|
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
command: pages deploy public --project-name=sukkaw-ruleset --commit-dirty=true --branch=main
|
|
||||||
wranglerVersion: ${{ env.WRANGLER_VERSION }}
|
|
||||||
- name: Upload Dist to GitLab
|
- name: Upload Dist to GitLab
|
||||||
id: deploy_gitlab
|
id: deploy_gitlab
|
||||||
background: true
|
background: true
|
||||||
@@ -253,6 +253,18 @@ jobs:
|
|||||||
GH_EMAIL: ${{ secrets.GIT_EMAIL }}
|
GH_EMAIL: ${{ secrets.GIT_EMAIL }}
|
||||||
GH_USER: ${{ secrets.GIT_USER }}
|
GH_USER: ${{ secrets.GIT_USER }}
|
||||||
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
|
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
|
||||||
|
# Cloudflare deploy needs its npm cache restored first
|
||||||
|
- wait: wrangler_npm_cache
|
||||||
|
- name: Deploy to Cloudflare Pages
|
||||||
|
id: deploy_cloudflare
|
||||||
|
uses: cloudflare/wrangler-action@v3
|
||||||
|
background: true
|
||||||
|
with:
|
||||||
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
|
command: pages deploy public --project-name=sukkaw-ruleset --commit-dirty=true --branch=main
|
||||||
|
wranglerVersion: ${{ env.WRANGLER_VERSION }}
|
||||||
|
# We wait for GitHub Dist to be deployed before checking its deployment status
|
||||||
- wait: upload_dist_to_github
|
- wait: upload_dist_to_github
|
||||||
- name: Wait for GitHub Pages to serve deployed marker
|
- name: Wait for GitHub Pages to serve deployed marker
|
||||||
if: steps.upload_dist_to_github.outcome == 'success'
|
if: steps.upload_dist_to_github.outcome == 'success'
|
||||||
|
|||||||
Reference in New Issue
Block a user