Skip to content

Merge pull request #149 from humanmade/fix-builds #24

Merge pull request #149 from humanmade/fix-builds

Merge pull request #149 from humanmade/fix-builds #24

Workflow file for this run

name: Build Release
on:
push:
branches:
- 'release'
jobs:
wordpress:
name: Release
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: mysqli, xmlwriter
coverage: none
tools: composer:v2
- name: Get Composer Cache Directory
id: composer-cache-dir
run: |
echo "DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache PHP Dependencies
id: composer-cache
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache-dir.outputs.DIR }}
key: ${{ runner.os }}-composer-7.4-${{ hashFiles('composer.lock') }}
- name: Install PHP Dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "DIR=$(npm config get cache)" >> $GITHUB_OUTPUT
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_OUTPUT
echo "NODE_VERSION=$(node -v)" >> $GITHUB_OUTPUT
- name: Cache JS Dependencies
id: npm-cache
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.DIR }}
key: ${{ runner.os }}-npm-${{ steps.npm-cache-dir.outputs.NODE_VERSION }}-${{ steps.npm-cache-dir.outputs.NPM_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: Install JS Dependencies
run: npm install --legacy-peer-deps
- name: Build Assets
run: npm run build
- name: Setup
run: 'echo "VERSION=$(grep -Po ''\"version\": \"[0-9\\.]+\"'' package.json | grep -Po ''[0-9\\.]+'')" >> $GITHUB_ENV'
- name: Tag
run: |
echo "Releasing version $VERSION ..."
git config user.name github-actions
git config user.email [email protected]
git checkout -b "release-$VERSION"
git add -f build/*
git add -f lib/*
git commit -m "Release $VERSION"
git tag "$VERSION"
git push --tags
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}