Skip to content

Commit

Permalink
factorize
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Oct 16, 2024
1 parent fea118f commit 5237e12
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 40 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: ./.github/workflows/shared/setup
- name: setup
uses: ./.github/workflows/shared/setup

- name: build
run: yarn ci:build
Expand All @@ -30,21 +31,23 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: ./.github/workflows/shared/setup
- name: setup
uses: ./.github/workflows/shared/setup

- name: e2e
run: |
yarn ci:build
yarn ci:e2e
# build-doc:
# runs-on: ubuntu-latest
# needs: build
build-doc:
runs-on: ubuntu-latest
needs: build

# steps:
# - uses: actions/checkout@v4
steps:
- uses: actions/checkout@v4

# - uses: ./.github/workflows/shared/setup
- name: setup
uses: ./.github/workflows/shared/setup

# - name: build-doc
# run: yarn ci:build-doc
- name: build
run: yarn ci:build-doc
17 changes: 3 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,13 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v4
- name: setup
uses: ./.github/workflows/shared/setup
with:
node-version: '20'

- name: data
id: data
run: |
echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: yarn cache ro
uses: actions/cache/restore@v4
with:
key: yarn-${{ hashFiles('yarn.lock') }}
path: ${{ steps.data.outputs.YARN_CACHE_DIR }}
turbo-cache: false

- name: build
run: |
yarn install --frozen-lockfile
yarn ci:version ${{ github.ref_name }}
yarn ci:build
Expand Down
36 changes: 20 additions & 16 deletions .github/workflows/shared/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: setup

inputs:
turbo-cache:
default: True

runs:
using: composite

Expand All @@ -16,35 +20,35 @@ runs:
- name: yarn cache
uses: actions/cache@v4
# if: github.ref_name == 'main'
if: ${{ !startsWith(github.ref_name, 'dependabot') }}
with:
key: yarn-${{ hashFiles('yarn.lock') }}
path: ${{ steps.data.outputs.YARN_CACHE_DIR }}

# - name: yarn cache ro
# uses: actions/cache/restore@v4
# if: github.ref_name != 'main'
# with:
# key: yarn-${{ hashFiles('yarn.lock') }}
# path: ${{ steps.data.outputs.YARN_CACHE_DIR }}
- name: yarn cache ro
uses: actions/cache/restore@v4
if: ${{ startsWith(github.ref_name, 'dependabot') }}
with:
key: yarn-${{ hashFiles('yarn.lock') }}
path: ${{ steps.data.outputs.YARN_CACHE_DIR }}

- name: turbo cache
uses: actions/cache@v4
# if: github.ref_name == 'main'
if: ${{ inputs.turbo-cache && !startsWith(github.ref_name, 'dependabot') }}
with:
path: .turbo
key: turbo-${{ github.sha }}
restore-keys: |
turbo-
# - name: turbo cache ro
# uses: actions/cache/restore@v4
# if: github.ref_name != 'main'
# with:
# path: .turbo
# key: turbo-${{ github.sha }}
# restore-keys: |
# turbo-
- name: turbo cache ro
uses: actions/cache/restore@v4
if: ${{ inputs.turbo-cache && startsWith(github.ref_name, 'dependabot') }}
with:
path: .turbo
key: turbo-${{ github.sha }}
restore-keys: |
turbo-
- name: install
shell: bash
Expand Down

0 comments on commit 5237e12

Please sign in to comment.