|
| 1 | +on: |
| 2 | + schedule: |
| 3 | + - cron: "0 0 * * 0" |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + update-esy-dependencies: |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + system: [ubuntu-latest] |
| 11 | + runs-on: ${{ matrix.system }} |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + - uses: actions/setup-node@v3 |
| 15 | + with: |
| 16 | + node-version: current |
| 17 | + - name: npm install |
| 18 | + run: npm install |
| 19 | + - name: Remove lockfile |
| 20 | + run: rm -rf esy.lock |
| 21 | + # Separating the esy steps provides more fine-grained insight when |
| 22 | + # debugging failed jobs |
| 23 | + - name: Update esy dependencies (esy install) |
| 24 | + run: npx esy install |
| 25 | + - name: Check if any dependencies were updated |
| 26 | + id: check-for-updates |
| 27 | + run: test -n "$(git status --porcelain)" |
| 28 | + continue-on-error: true |
| 29 | + - name: Build esy dependencies |
| 30 | + if: steps.check-for-updates.outcome == 'success' |
| 31 | + run: npx esy build-dependencies --release |
| 32 | + - name: Build project |
| 33 | + if: steps.check-for-updates.outcome == 'success' |
| 34 | + run: npx esy build --release |
| 35 | + - name: Bundle JS app |
| 36 | + if: steps.check-for-updates.outcome == 'success' |
| 37 | + run: npm run bundle |
| 38 | + - name: Create pull request to update dependencies |
| 39 | + if: steps.check-for-updates.outcome == 'success' |
| 40 | + uses: peter-evans/create-pull-request@v4 |
| 41 | + with: |
| 42 | + commit-message: Update esy dependencies |
| 43 | + branch: update-esy-dependencies |
| 44 | + delete-branch: true |
| 45 | + title: Update esy dependencies |
| 46 | + - name: Cache dependencies |
| 47 | + if: steps.check-for-updates.outcome == 'success' |
| 48 | + uses: actions/cache@v3 |
| 49 | + with: |
| 50 | + # The entire ~/.esy directory has to be cached because esy's |
| 51 | + # import/export commands don't import/export the Melange JS runtime |
| 52 | + # files |
| 53 | + path: ~/.esy |
| 54 | + key: ${{ matrix.system }}-esy-${{ hashFiles('esy.lock/index.json') }} |
0 commit comments