|
| 1 | +name: Update DB |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '30 12 * * *' |
| 6 | + |
| 7 | +jobs: |
| 8 | + browserlist-db: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + env: |
| 11 | + GH_BROWSERLIST_BRANCH: update-browserlist-db |
| 12 | + name: Updates the browserlist db |
| 13 | + steps: |
| 14 | + - name: ⬇️ Checkout |
| 15 | + uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Read NodeJS version from .nvmrc |
| 18 | + id: node-version |
| 19 | + uses: juliangruber/read-file-action@v1 |
| 20 | + with: |
| 21 | + path: ./.nvmrc |
| 22 | + trim: true |
| 23 | + |
| 24 | + - name: Setup NodeJS using the obtained nvm version |
| 25 | + uses: actions/setup-node@v2 |
| 26 | + with: |
| 27 | + node-version: ${{ steps.node-version.outputs.content }} |
| 28 | + |
| 29 | + - name: Restore cached node_modules |
| 30 | + uses: actions/cache@v2 |
| 31 | + with: |
| 32 | + path: '**/node_modules' |
| 33 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} |
| 34 | + |
| 35 | + - name: ▶️ Install Dependencies |
| 36 | + run: npm i |
| 37 | + |
| 38 | + - name: Create a branch |
| 39 | + uses: peterjgrainger/[email protected] |
| 40 | + env: |
| 41 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + with: |
| 43 | + branch: ${{ env.GH_BROWSERLIST_BRANCH }} |
| 44 | + |
| 45 | + - name: 🚀 Run the update-db command |
| 46 | + run: npx browserslist@latest --update-db |
| 47 | + |
| 48 | + - uses: EndBug/add-and-commit@v7 |
| 49 | + with: |
| 50 | + add: 'package-lock.json' |
| 51 | + branch: update-browserlist-db |
| 52 | + branch_mode: create |
| 53 | + # Determines the way the action fills missing author name and email. Three options are available: |
| 54 | + # - github_actor -> UserName <[email protected]> |
| 55 | + # - user_info -> Your Display Name <[email protected]> |
| 56 | + # - github_actions -> github-actions <email associated with the github logo> |
| 57 | + # Default: github_actor |
| 58 | + default_author: github_actor |
| 59 | + message: 'perf(browserlist): Deliver the Browserslist DB update' |
| 60 | + pull: 'NO-PULL' |
| 61 | +# - name: 🏗 Create Pull-Request into dist branch |
| 62 | +# if: steps.auto-commit.outputs.changes_detected == 'true' |
| 63 | +# uses: repo-sync/pull-request@v2 |
| 64 | +# with: |
| 65 | +# pr_title: 'perf(browserlist): Deliver the Browserslist DB update' |
| 66 | +# pr_body: ':crown: *An automated PR from the Browserlist workflow*' |
| 67 | +# source_branch: ${{ env.GH_BROWSERLIST_BRANCH }} |
| 68 | +# destination_branch: ${{ env.GH_DEV_BRANCH }} |
| 69 | +# github_token: ${{ secrets.GITHUB_TOKEN }} |
| 70 | +# |
| 71 | +# - name: Log a message there is anything to commit |
| 72 | +# if: steps.auto-commit.outputs.changes_detected == 'true' |
| 73 | +# run: echo 'There is a browserlist update' |
| 74 | +# |
| 75 | +# - name: Log a message if nothing to commit |
| 76 | +# if: steps.auto-commit.outputs.changes_detected == 'false' |
| 77 | +# run: echo 'Everything is up to date' |
0 commit comments