Skip to content

build

build #11935

Workflow file for this run

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/flarum-core
run: git clone https://github.com/flarum/flarum-core.git flarum
- name: PHP > Use PHP 7.4
if: ${{ matrix.language == 'php' }}
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: PHP > Doctum cache
uses: actions/cache@v3
with:
path: cache
key: ${{ runner.os }}-doctum
- name: JS > Use Node.js 16.x
if: ${{ matrix.language == 'js' }}
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: JS > Install dependencies
if: ${{ matrix.language == 'js' }}
run: npm ci
- 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/flarum-core@${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 }}