[FIX] wp cli cache dir #166
This file contains 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: Deploy | |
on: [ push ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- run: echo "Deployment triggered by a ${{ github.event_name }} event to the ${{ github.ref }} branch." | |
- uses: actions/checkout@v2 | |
- name: Add styleguide symlink | |
run: ln -sf wordpress/wp-content/themes/les-verts/styleguide/ styleguide | |
- name: Cache Composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/composer-cache | |
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | |
- name: Composer install | |
uses: php-actions/composer@v6 | |
with: | |
dev: no | |
interaction: no | |
args: --working-dir=wordpress/wp-content/themes/les-verts --ignore-platform-reqs | |
- name: Yarn install | |
uses: borales/actions-yarn@v3.0.0 | |
with: | |
cmd: install --frozen-lockfile # will run `yarn install` command | |
- name: Yarn gulp sg_custom | |
uses: borales/actions-yarn@v3.0.0 | |
with: | |
cmd: gulp sg:custom | |
- name: Yarn fractal:build | |
uses: borales/actions-yarn@v3.0.0 | |
with: | |
cmd: fractal:build | |
- name: Yarn build | |
uses: borales/actions-yarn@v3.0.0 | |
with: | |
cmd: build | |
- name: Prepare styleguide release | |
run: | | |
cp -r wordpress/wp-content/themes/les-verts/styleguide/dist/build gh-pages | |
- name: Prepare theme release | |
run: | | |
cd wordpress/wp-content/themes | |
mkdir les-verts/static | |
cp -r les-verts/styleguide/dist/static/js les-verts/static/js | |
cp -r les-verts/styleguide/dist/static/fonts les-verts/static/fonts | |
cp les-verts/styleguide/dist/static/icons.svg les-verts/static/icons.svg | |
cp les-verts/styleguide/dist/static/style.css les-verts/static/style.css | |
cp les-verts/styleguide/dist/static/style.min.css les-verts/static/style.min.css | |
sudo rm -rf les-verts/styleguide | |
zip -r release.zip les-verts | |
- name: Add theme to github pages | |
run: | | |
mkdir gh-pages/theme | |
cp wordpress/wp-content/themes/release.zip gh-pages/theme/les-verts.zip | |
- name: Parse version number | |
run: | | |
echo "THEME_VERSION=$(sed '/^\s*\*\s*Version:/! d; s/^\s*\*\s*Version:\s*//; s/\s*$//' wordpress/wp-content/themes/les-verts/style.css)" >> $GITHUB_ENV | |
- name: Set new version number in update.json | |
run: | | |
sed "s/%VERSION%/$THEME_VERSION/" update.json > gh-pages/theme/update.json | |
- name: Deploy to github pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/styleguide' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./gh-pages | |
- name: Prepare release | |
uses: "marvinpinto/action-automatic-releases@v1.2.1" | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ env.THEME_VERSION }}" | |
draft: true | |
prerelease: false | |
title: "${{ env.THEME_VERSION }}" | |
files: | | |
gh-pages/theme/les-verts.zip |