mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-14 02:00:37 +08:00
CI: run PR but only with diff [skip ci]
This commit is contained in:
parent
2d5febb455
commit
6606d5cb01
29
.github/workflows/main.yml
vendored
29
.github/workflows/main.yml
vendored
@ -3,6 +3,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
pull_request:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 12 * * *"
|
- cron: "0 12 * * *"
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ jobs:
|
|||||||
echo "public directory is ready: ${{ steps.ramdisk.outputs.build_dir }}"
|
echo "public directory is ready: ${{ steps.ramdisk.outputs.build_dir }}"
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-artifact-${{ github. ref_name }}
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
||||||
path: ${{ steps.ramdisk.outputs.build_dir }}
|
path: ${{ steps.ramdisk.outputs.build_dir }}
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
@ -117,6 +118,26 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
.cache
|
.cache
|
||||||
key: ${{ runner.os }}-v3-${{ steps.date.outputs.year }}-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }} ${{ steps.date.outputs.hour }}:${{ steps.date.outputs.minute }}:${{ steps.date.outputs.second }}
|
key: ${{ runner.os }}-v3-${{ steps.date.outputs.year }}-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }} ${{ steps.date.outputs.hour }}:${{ steps.date.outputs.minute }}:${{ steps.date.outputs.second }}
|
||||||
|
diff_deployment_on_pr:
|
||||||
|
if: github.ref != 'refs/heads/master'
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
name: Diff output
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
||||||
|
path: public
|
||||||
|
- name: Diff
|
||||||
|
run: |
|
||||||
|
git clone --filter=tree:0 --no-tags https://github.com/SukkaLab/ruleset.skk.moe.git ./deploy-git >/dev/null 2>&1
|
||||||
|
cd ./deploy-git
|
||||||
|
git fetch origin master >/dev/null 2>&1
|
||||||
|
rm -rf ./*
|
||||||
|
cp -rf ../public/* ./
|
||||||
|
git --no-pager diff --minimal
|
||||||
|
|
||||||
deploy_to_cloudflare_pages:
|
deploy_to_cloudflare_pages:
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
@ -137,7 +158,7 @@ jobs:
|
|||||||
key: ${{ runner.os }}-${{ runner.arch }}-deploy-to-cloudflare-npm
|
key: ${{ runner.os }}-${{ runner.arch }}-deploy-to-cloudflare-npm
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-artifact-${{ github.ref_name }}
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
||||||
path: public
|
path: public
|
||||||
- name: Deploy to Cloudflare Pages
|
- name: Deploy to Cloudflare Pages
|
||||||
uses: cloudflare/wrangler-action@v3
|
uses: cloudflare/wrangler-action@v3
|
||||||
@ -155,14 +176,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-artifact-${{ github.ref_name }}
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
||||||
path: public
|
path: public
|
||||||
- name: Upload Dist to GitLab
|
- name: Upload Dist to GitLab
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
git clone --filter=tree:0 --no-tags https://${GITLAB_TOKEN_NAME}:${GITLAB_TOKEN}@gitlab.com/SukkaW/ruleset.skk.moe.git ./deploy-git
|
git clone --filter=tree:0 --no-tags https://${GITLAB_TOKEN_NAME}:${GITLAB_TOKEN}@gitlab.com/SukkaW/ruleset.skk.moe.git ./deploy-git
|
||||||
cd ./deploy-git
|
cd ./deploy-git
|
||||||
git config --global push.default matching
|
git config --global push.dgefault matching
|
||||||
git config --global user.email "${GITLAB_EMAIL}"
|
git config --global user.email "${GITLAB_EMAIL}"
|
||||||
git config --global user.name "${GITLAB_USER}"
|
git config --global user.name "${GITLAB_USER}"
|
||||||
rm -rf ./*
|
rm -rf ./*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user