|
| 1 | +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 2 | + |
| 3 | +name: "Update version files" |
| 4 | + |
| 5 | +on: # yamllint disable-line rule:truthy |
| 6 | + schedule: |
| 7 | + - cron: "0 0 * * *" |
| 8 | + |
| 9 | +jobs: |
| 10 | + fetch-versions: |
| 11 | + name: "PHP ${{ matrix.php-versions }} fetch versions on ubuntu-latest OS with ${{ matrix.dependencies }} dependencies" |
| 12 | + |
| 13 | + runs-on: "ubuntu-latest" |
| 14 | + |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + php-versions: ["8.0"] |
| 18 | + dependencies: ["locked"] |
| 19 | + |
| 20 | + env: |
| 21 | + key: "fetch-versions-linux-v1" # change key (version) to clear cache |
| 22 | + extensions: "mbstring" |
| 23 | + ini-values: "date.timezone=Europe/Berlin, opcache.enable_cli=0, serialize_precision=14" |
| 24 | + tools: "composer" |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: "Git checkout" |
| 28 | + uses: "actions/checkout@v2" |
| 29 | + with: |
| 30 | + fetch-depth: 2 |
| 31 | + env: |
| 32 | + GIT_COMMITTER_NAME: "GitHub Actions Shell" |
| 33 | + GIT_AUTHOR_NAME: "GitHub Actions Shell" |
| 34 | + EMAIL: "github-actions[bot]@users.noreply.github.com" |
| 35 | + |
| 36 | + - name: "Setup cache environment" |
| 37 | + id: "cache-env" |
| 38 | + uses: "shivammathur/cache-extensions@v1" |
| 39 | + with: |
| 40 | + php-version: "${{ matrix.php-versions }}" |
| 41 | + extensions: "${{ env.extensions }}" |
| 42 | + key: "${{ env.key }}" |
| 43 | + |
| 44 | + - name: "Cache extensions" |
| 45 | + uses: "actions/cache@v2" |
| 46 | + with: |
| 47 | + path: "${{ steps.cache-env.outputs.dir }}" |
| 48 | + key: "${{ steps.cache-env.outputs.key }}" |
| 49 | + restore-keys: "${{ steps.cache-env.outputs.key }}" |
| 50 | + |
| 51 | + - name: "Setup PHP" |
| 52 | + uses: "shivammathur/setup-php@v2" |
| 53 | + with: |
| 54 | + php-version: "${{ matrix.php-versions }}" |
| 55 | + extensions: "${{ env.extensions }}" |
| 56 | + ini-values: "${{ env.ini-values }}" |
| 57 | + tools: "${{ env.tools }}" |
| 58 | + coverage: "pcov" |
| 59 | + |
| 60 | + - name: "Setup Problem Matchers for PHP" |
| 61 | + run: "echo '::add-matcher::${{ runner.tool_cache }}/php.json'" |
| 62 | + |
| 63 | + - name: "Check PHP Version" |
| 64 | + run: "php -v" |
| 65 | + |
| 66 | + - name: "List all php extensions with versions" |
| 67 | + run: "php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . \" \" . phpversion($extension) . PHP_EOL;'" |
| 68 | + |
| 69 | + - name: "Configure Container" |
| 70 | + env: |
| 71 | + GIT_USER_EMAIL: "${{ secrets.GIT_USER_EMAIL }}" |
| 72 | + GIT_USER_USERNAME: "${{ secrets.GIT_USER_USERNAME }}" |
| 73 | + run: | |
| 74 | + EMAIL=${GIT_USER_EMAIL:-"github-actions[bot]@users.noreply.github.com"} |
| 75 | + NAME=${GIT_USER_USERNAME:-"github-actions-shell"} |
| 76 | +
|
| 77 | + git config --global user.email "${EMAIL}" |
| 78 | + git config --global user.name "${NAME}" |
| 79 | +
|
| 80 | + - name: "Check Composer Version" |
| 81 | + run: "composer -V" |
| 82 | + |
| 83 | + - name: "Validate composer.json and composer.json" |
| 84 | + run: "composer validate --strict" |
| 85 | + |
| 86 | + - name: "Install dependencies with Composer" |
| 87 | + uses: "ramsey/composer-install@v1" |
| 88 | + with: |
| 89 | + dependency-versions: "${{ matrix.dependencies }}" |
| 90 | + |
| 91 | + - name: "Fetch versions" |
| 92 | + run: "php bin/versions.php" |
| 93 | + env: |
| 94 | + VERSIONS_GITHUB_TOKEN: "${{ secrets.VERSIONS_GITHUB_TOKEN }}" |
| 95 | + |
| 96 | + - name: "Commit modified files" |
| 97 | + uses: "stefanzweifel/[email protected]" |
| 98 | + with: |
| 99 | + commit_author: "Daniel Bannert <[email protected]>" |
| 100 | + commit_message: "feat: updated versions files" |
| 101 | + commit_user_email: "[email protected]" |
| 102 | + commit_user_name: "prisis" |
0 commit comments