build #12717
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 */12 * * *" | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - 'docs/**' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| language: ['js', 'php'] | |
| name: '${{ matrix.language }}' | |
| steps: | |
| - uses: actions/checkout@master | |
| with: | |
| persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
| fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
| - name: Clone flarum/framework | |
| run: git clone https://github.com/flarum/framework.git flarum | |
| - name: PHP > Use PHP 8.3 | |
| if: ${{ matrix.language == 'php' }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| - name: PHP > Doctum cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: cache | |
| key: ${{ runner.os }}-doctum | |
| - name: JS > Use Node.js 22.x | |
| if: ${{ matrix.language == 'js' }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22.x | |
| - name: JS > Install dependencies | |
| if: ${{ matrix.language == 'js' }} | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: ./scripts/build-${{ matrix.language }}.sh | |
| - name: Commit | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add docs | |
| if [ "$(git status --porcelain docs/${{ matrix.language }} | wc -l)" -lt "2" ]; then | |
| echo "No changes to commit" | |
| git reset | |
| git checkout -- . | |
| else | |
| git commit -m "${{ matrix.language }}: update (flarum/framework@${FLARUM_SHA})" docs | |
| fi | |
| - name: Pull | |
| run: git pull --rebase | |
| - name: Push | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} |