Skip to content

Commit

Permalink
ci(feed): キャッシュの復元と保存はcompositeで再利用する
Browse files Browse the repository at this point in the history
  • Loading branch information
yamadashy committed Dec 15, 2024
1 parent 0f84f97 commit 4450921
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 36 deletions.
17 changes: 17 additions & 0 deletions .github/actions/restore-feed-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Restore Feed Cache'

runs:
using: "composite"
steps:
- name: Restore feed cache
uses: actions/cache/restore@v4
with:
path: |
.cache
public/images/feed-thumbnails
public/images/feed-icons
# キャッシュのキーは毎回変えて保存。restore-keys によって最新が使われる
# see: https://github.com/actions/cache/issues/342#issuecomment-673371329
key: ${{ runner.os }}-feed-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-feed-
13 changes: 13 additions & 0 deletions .github/actions/save-feed-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Save Feed Cache'

runs:
using: "composite"
steps:
- name: Save feed cache
uses: actions/cache/save@v4
with:
path: |
.cache
public/images/feed-thumbnails
public/images/feed-icons
key: ${{ runner.os }}-feed-${{ github.run_id }}
20 changes: 2 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,8 @@ jobs:
node-version-file: .tool-versions
cache: npm
- run: npm ci
- uses: actions/cache/restore@v4
with:
path: |
.cache
public/images/feed-thumbnails
public/images/feed-icons
# キャッシュのキーは毎回変えて保存。restore-keys によって最新が使われる
# see: https://github.com/actions/cache/issues/342#issuecomment-673371329
key: ${{ runner.os }}-feed-images-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-feed-images-
- uses: ./.github/actions/restore-feed-cache
- run: npm run feed-generate
- run: npm run site-prepare
- run: npm run site-build
- uses: actions/cache/save@v4
with:
path: |
.cache
public/images/feed-thumbnails
public/images/feed-icons
key: ${{ runner.os }}-feed-images-${{ github.run_id }}
- uses: ./.github/actions/save-feed-cache
2 changes: 2 additions & 0 deletions .github/workflows/external-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ jobs:
node-version-file: .tool-versions
cache: npm
- run: npm ci
- uses: ./.github/actions/restore-feed-cache
- run: npm run test-external
- uses: ./.github/actions/save-feed-cache
20 changes: 2 additions & 18 deletions .github/workflows/generate-feed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,11 @@ jobs:
node-version-file: .tool-versions
cache: npm
- run: npm ci
- uses: actions/cache/restore@v4
with:
path: |
.cache
public/images/feed-thumbnails
public/images/feed-icons
# キャッシュのキーは毎回変えて保存。restore-keys によって最新が使われる
# see: https://github.com/actions/cache/issues/342#issuecomment-673371329
key: ${{ runner.os }}-feed-images-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-feed-images-
- uses: ./.github/actions/restore-feed-cache
- run: npm run feed-generate
- run: npm run site-prepare
- run: npm run site-build
- uses: actions/cache/save@v4
with:
path: |
.cache
public/images/feed-thumbnails
public/images/feed-icons
key: ${{ runner.os }}-feed-images-${{ github.run_id }}
- uses: ./.github/actions/save-feed-cache
- uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 4450921

Please sign in to comment.