diff --git a/.github/workflows/update-filecache.yml b/.github/workflows/update-filecache.yml index bc3cbb2c..29bfed51 100644 --- a/.github/workflows/update-filecache.yml +++ b/.github/workflows/update-filecache.yml @@ -1,91 +1,37 @@ -# Ensure a consistent state for production releases -name: Prepare for production +name: Update Filecache on: push: - branches: [ master ] - pull_request: - branches: [ master ] + branches: [master] + + workflow_dispatch: permissions: - contents: read + contents: write + pull-requests: write jobs: - build-and-test: - + build-filecache: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v3 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install Composer dependencies - run: composer install --prefer-dist --no-progress - - - name: Run test suite - run: vendor/bin/pest - - rebuild-frontend-files: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v3 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- + - uses: actions/checkout@v3 - - name: Install Composer dependencies - run: composer install --prefer-dist --no-progress - - - name: Clean _site directory - run: rm -rf _site && mkdir _site - - name: Clean _media directory - run: rm -rf _media && mkdir _media + - name: Compile the checksums and save the filecache + run: cd resources/data && php filecacheGenerator.php - - name: Setup Node.js 16.x - uses: actions/setup-node@v3 - with: - node-version: 16.x - cache: 'npm' - - name: Install Node dependencies - run: npm ci - - name: Build frontend files - run: npm run prod + - name: Check if any changes were made + uses: tj-actions/verify-changed-files@v9 + id: verify-changed-files + with: + files: resources/data/filecache.json - propagate-frontend-to-hydefront: - if: github.event_name == 'push' - needs: rebuild-frontend-files - runs-on: ubuntu-latest - steps: - - name: Todo implement job - run: echo Not yet implemented - - create-hyde-merge-pull-request: - needs: [build-and-test, rebuild-frontend-files] - runs-on: ubuntu-latest - steps: - - name: Create Pull Request with the new assets + - name: Create Pull Request with the new filecache + if: steps.verify-changed-files.outputs.files_changed == 'true' uses: peter-evans/create-pull-request@v4 with: - commit-message: Automatic build update - title: Update Frontend Assets - body: Updated default app.css and cleaned the media directories. - branch: update-frontend + commit-message: Automatic Filecache Update + title: Update Filecache + body: Updated the filecache.json with new resource file checksums. + branch: update-checksums base: master -