force-production-on-main.yml (2069B)
1 name: Build production assets 2 on: 3 push: 4 branches: 5 - main 6 jobs: 7 build: 8 name: Build and commit 9 runs-on: ubuntu-latest 10 strategy: 11 fail-fast: false 12 matrix: 13 php: [8.0] 14 node-version: [14.x] 15 steps: 16 - name: Checkout code 17 uses: actions/checkout@v1 18 19 - name: Set up git user 20 run: git config --global user.name extendify 21 - name: Set up git email 22 run: git config --global user.name extendify@users.noreply.github.com 23 24 - name: Setup PHP 25 uses: shivammathur/setup-php@v2 26 with: 27 php-version: '${{ matrix.php }}' 28 extensions: mysql, zip 29 coverage: none 30 tools: composer:v1, wp-cli, cs2pr, phpcs 31 32 - name: Get Composer cache directory 33 id: composer-cache 34 run: | 35 echo "::set-output name=dir::$(composer config cache-files-dir)" 36 - name: Use Composer cache 37 uses: actions/cache@master 38 with: 39 path: ${{ steps['composer-cache'].outputs.dir }} 40 key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} 41 restore-keys: | 42 ${{ runner.os }}-composer- 43 - name: Build autoloader 44 run: composer install --prefer-dist --no-progress --no-suggest --no-dev 45 46 - name: Using Node version ${{ matrix.node-version }} 47 uses: actions/setup-node@v1 48 with: 49 node-version: ${{ matrix.node-version }} 50 - name: npm install, build, and test 51 run: | 52 npm ci 53 npm run build 54 env: 55 CI: true 56 - name: Increment version number 57 run: | 58 perl -i -pe 's/(Stable tag: )([\d.]+)$/$1.($2+.1)/e' readme.txt 59 - name: Commit dist folder if needed #it fails if nothing has changed so we allow an error 60 run: git commit -am 'Build produciton assets' 61 continue-on-error: true 62 - name: Push changed files to main 63 uses: ad-m/github-push-action@master 64 with: 65 github_token: ${{ secrets.GITHUB_TOKEN }} 66 branch: main