Skip to content

Commit

Permalink
Improved action workflow (#1241)
Browse files Browse the repository at this point in the history
  • Loading branch information
melroy89 authored Nov 24, 2024
1 parent 9538dda commit acf1f81
Showing 1 changed file with 9 additions and 33 deletions.
42 changes: 9 additions & 33 deletions .github/workflows/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,22 @@ jobs:
id: npm-cache-dir-path
run: echo "dir=$(npm get cache)" >> $GITHUB_OUTPUT

- name: Calculate package-lock.json hash
id: npm-lock-hash
run: |
echo "hash=$(md5sum package-lock.json)" >> $GITHUB_OUTPUT
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Calculate composer.lock hash
id: composer-lock-hash
run: |
echo "hash=$(md5sum composer.lock)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ steps.npm-lock-hash.outputs.hash }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-

- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-no-dev-${{ steps.composer-lock-hash.outputs.hash }}
key: ${{ runner.os }}-composer-no-dev-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-no-dev-

- run: cp .env.example .env
Expand All @@ -75,15 +65,10 @@ jobs:
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Calculate composer.lock hash
id: composer-lock-hash
run: |
echo "hash=$(md5sum composer.lock)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.composer-lock-hash.outputs.hash }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- run: cp .env.example .env
Expand All @@ -104,20 +89,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get Composer Cache Directory
- name: Get Composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Calculate composer.lock hash
id: composer-lock-hash
run: |
echo "hash=$(md5sum composer.lock)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
- name: Cache vendor directory
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.composer-lock-hash.outputs.hash }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- run: cp .env.example .env
Expand All @@ -144,15 +125,10 @@ jobs:
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Calculate tools/composer.lock hash
id: composer-lock-hash
run: |
echo "hash=$(md5sum tools/composer.lock)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-tools-${{ steps.composer-lock-hash.outputs.hash }}
key: ${{ runner.os }}-composer-tools-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-tools-

- name: Composer tools install
Expand Down

0 comments on commit acf1f81

Please sign in to comment.