mirror of
https://gitee.com/huanghongxun/HMCL-docs.git
synced 2025-11-05 02:14:25 +08:00
仅在监听模式下启用 ruby 缓存 (#322)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
df53ff9f4f
commit
ddf0e0d132
18
.github/workflows/pr-preview.yml
vendored
18
.github/workflows/pr-preview.yml
vendored
@ -12,7 +12,7 @@ env:
|
|||||||
JEKYLL_ENV: production
|
JEKYLL_ENV: production
|
||||||
jobs:
|
jobs:
|
||||||
preview-remove:
|
preview-remove:
|
||||||
if: >-
|
if:
|
||||||
${{
|
${{
|
||||||
!github.event.repository.fork && (
|
!github.event.repository.fork && (
|
||||||
( github.event_name == 'pull_request_target' && (
|
( github.event_name == 'pull_request_target' && (
|
||||||
@ -119,7 +119,7 @@ jobs:
|
|||||||
name: "preview/watch"
|
name: "preview/watch"
|
||||||
});
|
});
|
||||||
preview-create-init:
|
preview-create-init:
|
||||||
if: >-
|
if:
|
||||||
${{
|
${{
|
||||||
!github.event.repository.fork && (
|
!github.event.repository.fork && (
|
||||||
( github.event_name == 'pull_request_target' && (
|
( github.event_name == 'pull_request_target' && (
|
||||||
@ -189,6 +189,15 @@ jobs:
|
|||||||
preview-create-build:
|
preview-create-build:
|
||||||
needs: preview-create-init
|
needs: preview-create-init
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
PREVIEW_WATCH:
|
||||||
|
${{
|
||||||
|
contains(github.event.pull_request.labels.*.name, 'preview/watch') ||
|
||||||
|
contains(github.event.issue.labels.*.name, 'preview/watch') || (
|
||||||
|
github.event_name == 'issue_comment' &&
|
||||||
|
github.event.comment.body == '/preview watch'
|
||||||
|
)
|
||||||
|
}}
|
||||||
outputs:
|
outputs:
|
||||||
artifact-id: ${{ steps.upload-site.outputs.artifact-id }}
|
artifact-id: ${{ steps.upload-site.outputs.artifact-id }}
|
||||||
steps:
|
steps:
|
||||||
@ -207,8 +216,8 @@ jobs:
|
|||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: "3.4"
|
ruby-version: "3.4"
|
||||||
bundler-cache: true
|
bundler-cache: ${{ env.PREVIEW_WATCH }}
|
||||||
cache-version: pr${{ env.GITHUB_PR_NUMBER }}
|
cache-version: PR-${{ env.GITHUB_PR_NUMBER }}
|
||||||
- name: Jekyll Build
|
- name: Jekyll Build
|
||||||
run: |
|
run: |
|
||||||
echo "url: https://${{ needs.preview-create-init.outputs.domain }}" > _action.yml
|
echo "url: https://${{ needs.preview-create-init.outputs.domain }}" > _action.yml
|
||||||
@ -217,6 +226,7 @@ jobs:
|
|||||||
echo "destination: /home/runner/site" >> _action.yml
|
echo "destination: /home/runner/site" >> _action.yml
|
||||||
echo "preview:" >> _action.yml
|
echo "preview:" >> _action.yml
|
||||||
echo " pr-number: ${{ env.GITHUB_PR_NUMBER }}" >> _action.yml
|
echo " pr-number: ${{ env.GITHUB_PR_NUMBER }}" >> _action.yml
|
||||||
|
${{ env.PREVIEW_WATCH }} || bundle install --jobs 4
|
||||||
bundle exec jekyll build --config _config.yml,_action.yml
|
bundle exec jekyll build --config _config.yml,_action.yml
|
||||||
- id: upload-site
|
- id: upload-site
|
||||||
name: Upload Site
|
name: Upload Site
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user