From acf1f819272d2ec951742a4bf79cd12fdac19832 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Sun, 24 Nov 2024 13:26:25 +0100 Subject: [PATCH] Improved action workflow (#1241) --- .github/workflows/action.yaml | 42 ++++++++--------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index ec14b5a65..d2a68aee1 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -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 @@ -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 @@ -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 @@ -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