|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - patch-1 |
| 9 | + paths: |
| 10 | + - ./ui/** |
| 11 | + |
| 12 | +# schedule: |
| 13 | +## https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule |
| 14 | +## ┌───────────── minute (0 - 59) |
| 15 | +## │ ┌───────────── hour (0 - 23) |
| 16 | +## │ │ ┌───────────── day of the month (1 - 31) |
| 17 | +## │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) |
| 18 | +## │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) |
| 19 | +## │ │ │ │ │ |
| 20 | +## │ │ │ │ │ |
| 21 | +## │ │ │ │ │ |
| 22 | +## * * * * * |
| 23 | +# - cron: '* * 1 * *' |
| 24 | +# - cron: '* * 15 * *' |
| 25 | + |
| 26 | +jobs: |
| 27 | + main-action: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 30 | + |
| 31 | + strategy: |
| 32 | + matrix: |
| 33 | + node-version: [ 22 ] |
| 34 | + |
| 35 | + steps: |
| 36 | + - |
| 37 | + uses: actions/checkout@main |
| 38 | + with: |
| 39 | + fetch-depth: 2 |
| 40 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + - |
| 42 | + name: Set up Node.js ${{ matrix.node-version }} |
| 43 | + uses: actions/setup-node@main |
| 44 | + with: |
| 45 | + node-version: ${{ matrix.node-version }} |
| 46 | + - |
| 47 | + name: get yarn cache dir |
| 48 | + id: yarn-cache |
| 49 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 50 | + - |
| 51 | + name: set cache id |
| 52 | + id: id-cache |
| 53 | + run: echo "::set-output name=id::${GITHUB_SHA}" |
| 54 | + - |
| 55 | + name: echo var |
| 56 | + run: | |
| 57 | + echo ${{ steps.yarn-cache.outputs.dir }} |
| 58 | + echo ${{ steps.id-cache.outputs.id }} |
| 59 | + echo ${GITHUB_SHA} |
| 60 | + - |
| 61 | + name: yarn cache |
| 62 | + uses: bluelovers/github-actions-cache@2020011001 |
| 63 | + with: |
| 64 | + path: ${{ steps.yarn-cache.outputs.dir }} |
| 65 | + key: ${{ runner.os }}-yarn-${{ steps.id-cache.outputs.id }} |
| 66 | + restore-keys: | |
| 67 | + ${{ runner.os }}-yarn- |
| 68 | + - |
| 69 | + name: setup git config |
| 70 | + run: | |
| 71 | + git config --local user.email "action@github.com" |
| 72 | + git config --local user.name "GitHub Action" |
| 73 | + - |
| 74 | + name: install deps |
| 75 | + run: | |
| 76 | + cd ./ui |
| 77 | + yarn install --frozen-lockfile |
| 78 | + yarn run ci:install |
| 79 | + - |
| 80 | + name: run script |
| 81 | + if: success() |
| 82 | + # env: |
| 83 | + run: | |
| 84 | + cd ./ui |
| 85 | + yarn run ci:build |
| 86 | + - |
| 87 | + name: Push changes |
| 88 | + if: success() |
| 89 | + uses: ad-m/github-push-action@master |
| 90 | + with: |
| 91 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments