2021-11-10 22:04:36 +00:00
|
|
|
name: Mirrors
|
|
|
|
on:
|
2022-02-17 19:11:10 +00:00
|
|
|
push:
|
|
|
|
branches: ["trunk", "release/**"]
|
2021-11-10 22:04:36 +00:00
|
|
|
jobs:
|
2022-02-17 19:11:10 +00:00
|
|
|
build:
|
2022-02-17 21:16:32 +00:00
|
|
|
if: github.repository == 'woocommerce/woocommerce'
|
2022-02-17 19:11:10 +00:00
|
|
|
name: Build WooCommerce zip
|
2022-04-27 01:28:56 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2022-02-17 19:11:10 +00:00
|
|
|
steps:
|
2022-04-27 13:40:37 +00:00
|
|
|
- name: Checkout code.
|
2022-04-21 18:29:53 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2022-05-02 23:48:20 +00:00
|
|
|
- name: Cache modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
id: cache-deps
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.pnpm-store
|
|
|
|
plugins/woocommerce/packages
|
|
|
|
plugins/woocommerce/**/vendor
|
2022-05-04 22:20:31 +00:00
|
|
|
key: ${{ runner.os }}-npm-composer-version-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
2022-05-02 23:48:20 +00:00
|
|
|
|
2022-04-27 13:40:37 +00:00
|
|
|
- name: Install PNPM
|
2022-05-02 17:08:52 +00:00
|
|
|
run: npm install -g pnpm@^6.24.2
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2022-05-02 23:48:20 +00:00
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: '7.4'
|
|
|
|
|
2022-04-27 13:40:37 +00:00
|
|
|
- name: Build zip
|
2022-05-02 23:48:20 +00:00
|
|
|
working-directory: plugins/woocommerce
|
|
|
|
run: bash bin/build-zip.sh
|
2022-04-27 13:40:37 +00:00
|
|
|
|
|
|
|
- name: Upload the zip file as an artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
2022-02-17 19:11:10 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
name: woocommerce
|
2022-04-27 13:40:37 +00:00
|
|
|
path: plugins/woocommerce/woocommerce.zip
|
2022-02-17 19:11:10 +00:00
|
|
|
retention-days: 7
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2022-02-17 19:11:10 +00:00
|
|
|
mirror:
|
2022-02-17 21:16:32 +00:00
|
|
|
if: github.repository == 'woocommerce/woocommerce'
|
2022-02-17 19:11:10 +00:00
|
|
|
name: Push to Mirror
|
|
|
|
needs: [build]
|
2022-04-27 13:40:37 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2022-02-17 19:11:10 +00:00
|
|
|
steps:
|
|
|
|
- name: Create directories
|
|
|
|
run: |
|
|
|
|
mkdir -p tmp/woocommerce-build
|
|
|
|
mkdir -p monorepo
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2022-02-17 19:11:10 +00:00
|
|
|
- name: Checkout monorepo
|
2022-04-27 13:40:37 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-02-17 19:11:10 +00:00
|
|
|
with:
|
|
|
|
path: monorepo
|
2022-04-27 13:40:37 +00:00
|
|
|
|
|
|
|
- name: Copy Composer over to production
|
|
|
|
run: cp monorepo/plugins/woocommerce/composer.json tmp/woocommerce-build
|
|
|
|
|
2022-02-17 19:11:10 +00:00
|
|
|
- name: Download WooCommerce ZIP
|
2022-04-27 13:40:37 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2022-02-17 19:11:10 +00:00
|
|
|
with:
|
|
|
|
name: woocommerce
|
|
|
|
path: tmp/woocommerce-build
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2022-02-17 19:11:10 +00:00
|
|
|
- name: Extract and replace WooCommerce zip.
|
|
|
|
working-directory: tmp/woocommerce-build
|
|
|
|
run: |
|
|
|
|
mkdir -p woocommerce/woocommerce-production
|
|
|
|
unzip woocommerce.zip -d woocommerce/woocommerce-production
|
|
|
|
mv woocommerce/woocommerce-production/woocommerce/* woocommerce/woocommerce-production
|
|
|
|
rm -rf woocommerce/woocommerce-production/woocommerce
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2022-02-17 19:11:10 +00:00
|
|
|
- name: Set up mirror
|
|
|
|
working-directory: tmp/woocommerce-build
|
|
|
|
run: |
|
|
|
|
touch mirrors.txt
|
|
|
|
echo "woocommerce/woocommerce-production" >> mirrors.txt
|
2022-04-27 13:40:37 +00:00
|
|
|
|
2022-02-17 19:11:10 +00:00
|
|
|
- name: Push to mirror
|
|
|
|
uses: Automattic/action-push-to-mirrors@v1
|
|
|
|
with:
|
|
|
|
source-directory: ${{ github.workspace }}/monorepo
|
|
|
|
token: ${{ secrets.API_TOKEN_GITHUB }}
|
|
|
|
username: matticbot
|
|
|
|
working-directory: ${{ github.workspace }}/tmp/woocommerce-build
|
|
|
|
timeout-minutes: 5 # 2021-01-18: Successful runs seem to take about half a minute.
|