workflow: allow skip-cache

This commit is contained in:
undefined committed 2022-10-04 22:05:57 +08:00
1 parent 8cffe19609
commit 4a7f18ba14
1 file changed
+16 -7
+16 -7
View File
@@ -11,9 +11,6 @@ env:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
LICENSE_KEY: ${{ secrets.MAXMIND_KEY }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps: steps:
- name: Check out - name: Check out
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -27,15 +24,25 @@ jobs:
- name: Get yarn cache directory path - name: Get yarn cache directory path
id: yarn-cache-dir-path id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3 - name: skip-cache
id: yarn-cache id: skip-cache
uses: saulmaldonado/skip-workflow@v1
with: with:
phrase: 'skip-cache'
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@v3
if: ${{ steps.skip-cache.outputs.skip }}
with: &cacheWith
path: | path: |
${{ steps.yarn-cache-dir-path.outputs.dir }} ${{ steps.yarn-cache-dir-path.outputs.dir }}
yarn.lock yarn.lock
.cache .cache
**/tsconfig.tsbuildinfo **/tsconfig.tsbuildinfo
key: cache-${{ github.ref }}-${{ github.sha }} key: cache-${{ github.ref }}-${{ github.sha }}
- uses: actions/cache@v3
if: ${{ !steps.skip-cache.outputs.skip }}
with:
<<: *cacheWith
restore-keys: | restore-keys: |
cache-${{ github.ref }}- cache-${{ github.ref }}-
cache- cache-
@@ -45,6 +52,8 @@ jobs:
git config --global user.name undefined git config --global user.name undefined
git config --global user.email i@undefined.moe git config --global user.email i@undefined.moe
yarn yarn
env:
LICENSE_KEY: ${{ secrets.MAXMIND_KEY }}
- name: Get specific changed files - name: Get specific changed files
id: ui-changed-files id: ui-changed-files
uses: tj-actions/changed-files@v23.1 uses: tj-actions/changed-files@v23.1
@@ -64,11 +73,11 @@ jobs:
else else
parallel --tty -j+0 yarn ::: lint:ci build test parallel --tty -j+0 yarn ::: lint:ci build test
fi fi
env:
PT_PROJECT_TOKEN: ${{ secrets.PT_PROJECT_TOKEN }}
- name: Publish - name: Publish
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name == 'push' }}
run: node build/publish.js run: node build/publish.js
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# - name: Benchmark # - name: Benchmark
# run: yarn benchmark # run: yarn benchmark
# - name: Benchmark result # - name: Benchmark result