|
@@ -21,43 +21,13 @@ jobs:
|
|
|
steps:
|
|
steps:
|
|
|
- uses: smorimoto/tune-github-hosted-runner-network@v1
|
|
- uses: smorimoto/tune-github-hosted-runner-network@v1
|
|
|
# https://github.com/actions/runner-images/issues/1187
|
|
# https://github.com/actions/runner-images/issues/1187
|
|
|
- - uses: actions/checkout@v6
|
|
|
|
|
|
|
+ - uses: actions/checkout@v7
|
|
|
with:
|
|
with:
|
|
|
persist-credentials: false
|
|
persist-credentials: false
|
|
|
- - uses: pnpm/action-setup@v5
|
|
|
|
|
- with:
|
|
|
|
|
- run_install: false
|
|
|
|
|
- - uses: actions/setup-node@v6
|
|
|
|
|
- with:
|
|
|
|
|
- node-version-file: ".node-version"
|
|
|
|
|
- cache: "pnpm"
|
|
|
|
|
- name: Grab Building Folder
|
|
- name: Grab Building Folder
|
|
|
id: ramdisk
|
|
id: ramdisk
|
|
|
run: |
|
|
run: |
|
|
|
echo "build_dir=previous-build-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_OUTPUT
|
|
echo "build_dir=previous-build-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_OUTPUT
|
|
|
- - name: Download Previous Build
|
|
|
|
|
- uses: actions/checkout@v6
|
|
|
|
|
- with:
|
|
|
|
|
- repository: SukkaLab/ruleset.skk.moe
|
|
|
|
|
- # during a race condition the dist repo may be private, use token to clone
|
|
|
|
|
- token: ${{ secrets.GIT_TOKEN }}
|
|
|
|
|
- persist-credentials: false
|
|
|
|
|
- filter: "tree:0" # we don't care about git history here
|
|
|
|
|
- fetch-tags: false
|
|
|
|
|
- path: ${{ steps.ramdisk.outputs.build_dir }}
|
|
|
|
|
- - name: Setup build folder
|
|
|
|
|
- run: |
|
|
|
|
|
- if [ ! -d ${{ steps.ramdisk.outputs.build_dir }}/.git ]; then
|
|
|
|
|
- echo ".git not found"
|
|
|
|
|
- exit 1
|
|
|
|
|
- fi
|
|
|
|
|
- rm -rf "${{ steps.ramdisk.outputs.build_dir }}/.git"
|
|
|
|
|
-
|
|
|
|
|
- if [ ! -d ${{ steps.ramdisk.outputs.build_dir }}/List ]; then
|
|
|
|
|
- echo "List not found"
|
|
|
|
|
- exit 1
|
|
|
|
|
- fi
|
|
|
|
|
- echo "public directory is ready: ${{ steps.ramdisk.outputs.build_dir }}"
|
|
|
|
|
- name: Get current date
|
|
- name: Get current date
|
|
|
id: date
|
|
id: date
|
|
|
run: |
|
|
run: |
|
|
@@ -68,9 +38,24 @@ jobs:
|
|
|
echo "hour=$(date +'%H')" >> $GITHUB_OUTPUT
|
|
echo "hour=$(date +'%H')" >> $GITHUB_OUTPUT
|
|
|
echo "minute=$(date +'%M')" >> $GITHUB_OUTPUT
|
|
echo "minute=$(date +'%M')" >> $GITHUB_OUTPUT
|
|
|
echo "second=$(date +'%S')" >> $GITHUB_OUTPUT
|
|
echo "second=$(date +'%S')" >> $GITHUB_OUTPUT
|
|
|
|
|
+ # Download previous build and restore cache.db in the background,
|
|
|
|
|
+ # while the Node.js toolchain is set up in the foreground
|
|
|
|
|
+ - name: Download Previous Build
|
|
|
|
|
+ id: download_previous_build
|
|
|
|
|
+ uses: actions/checkout@v6
|
|
|
|
|
+ background: true
|
|
|
|
|
+ with:
|
|
|
|
|
+ repository: SukkaLab/ruleset.skk.moe
|
|
|
|
|
+ # during a race condition the dist repo may be private, use token to clone
|
|
|
|
|
+ token: ${{ secrets.GIT_TOKEN }}
|
|
|
|
|
+ persist-credentials: false
|
|
|
|
|
+ filter: "tree:0" # we don't care about git history here
|
|
|
|
|
+ fetch-tags: false
|
|
|
|
|
+ path: ${{ steps.ramdisk.outputs.build_dir }}
|
|
|
- name: Restore cache.db
|
|
- name: Restore cache.db
|
|
|
uses: actions/cache/restore@v6
|
|
uses: actions/cache/restore@v6
|
|
|
id: cache-db-restore
|
|
id: cache-db-restore
|
|
|
|
|
+ background: true
|
|
|
with:
|
|
with:
|
|
|
path: |
|
|
path: |
|
|
|
.cache
|
|
.cache
|
|
@@ -83,8 +68,32 @@ jobs:
|
|
|
${{ runner.os }}-v3-${{ steps.date.outputs.year }}-${{ steps.date.outputs.month }}-
|
|
${{ runner.os }}-v3-${{ steps.date.outputs.year }}-${{ steps.date.outputs.month }}-
|
|
|
${{ runner.os }}-v3-${{ steps.date.outputs.year }}-
|
|
${{ runner.os }}-v3-${{ steps.date.outputs.year }}-
|
|
|
${{ runner.os }}-v3-
|
|
${{ runner.os }}-v3-
|
|
|
|
|
+ # Setup Node.js and pnpm in foreground
|
|
|
|
|
+ - uses: pnpm/action-setup@v6
|
|
|
|
|
+ with:
|
|
|
|
|
+ run_install: false
|
|
|
|
|
+ - uses: actions/setup-node@v6
|
|
|
|
|
+ with:
|
|
|
|
|
+ node-version-file: ".node-version"
|
|
|
|
|
+ cache: "pnpm"
|
|
|
- run: pnpm config set --location=global minimumReleaseAge 0
|
|
- run: pnpm config set --location=global minimumReleaseAge 0
|
|
|
- run: pnpm install
|
|
- run: pnpm install
|
|
|
|
|
+ # Foreground pnpm + Node.js setup complete, ensure previous build and cache.db are ready
|
|
|
|
|
+ - wait: [download_previous_build, cache-db-restore]
|
|
|
|
|
+ # Double check build folder before starting build
|
|
|
|
|
+ - name: Setup build folder
|
|
|
|
|
+ run: |
|
|
|
|
|
+ if [ ! -d ${{ steps.ramdisk.outputs.build_dir }}/.git ]; then
|
|
|
|
|
+ echo ".git not found"
|
|
|
|
|
+ exit 1
|
|
|
|
|
+ fi
|
|
|
|
|
+ rm -rf "${{ steps.ramdisk.outputs.build_dir }}/.git"
|
|
|
|
|
+
|
|
|
|
|
+ if [ ! -d ${{ steps.ramdisk.outputs.build_dir }}/List ]; then
|
|
|
|
|
+ echo "List not found"
|
|
|
|
|
+ exit 1
|
|
|
|
|
+ fi
|
|
|
|
|
+ echo "public directory is ready: ${{ steps.ramdisk.outputs.build_dir }}"
|
|
|
- run: pnpm run build
|
|
- run: pnpm run build
|
|
|
env:
|
|
env:
|
|
|
PUBLIC_DIR: ${{ steps.ramdisk.outputs.build_dir }}
|
|
PUBLIC_DIR: ${{ steps.ramdisk.outputs.build_dir }}
|
|
@@ -105,7 +114,10 @@ jobs:
|
|
|
exit 1
|
|
exit 1
|
|
|
fi
|
|
fi
|
|
|
echo "public directory is ready: ${{ steps.ramdisk.outputs.build_dir }}"
|
|
echo "public directory is ready: ${{ steps.ramdisk.outputs.build_dir }}"
|
|
|
|
|
+ # Upload artifact and save cache.db in parallel
|
|
|
- uses: actions/upload-artifact@v7
|
|
- uses: actions/upload-artifact@v7
|
|
|
|
|
+ id: upload_build_artifact
|
|
|
|
|
+ background: true
|
|
|
with:
|
|
with:
|
|
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
|
|
path: ${{ steps.ramdisk.outputs.build_dir }}
|
|
path: ${{ steps.ramdisk.outputs.build_dir }}
|
|
@@ -120,6 +132,7 @@ 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 }}
|
|
|
|
|
+ - wait: upload_build_artifact
|
|
|
|
|
|
|
|
diff_deployment_on_pr:
|
|
diff_deployment_on_pr:
|
|
|
if: github.ref != 'refs/heads/master'
|
|
if: github.ref != 'refs/heads/master'
|