woocommerce/.github/workflows/mirrors.yml

86 lines
2.6 KiB
YAML
Raw Normal View History

name: Mirrors
on:
push:
branches: ["trunk", "release/**"]
jobs:
build:
2022-02-17 21:16:32 +00:00
if: github.repository == 'woocommerce/woocommerce'
name: Build WooCommerce zip
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/cache-deps
with:
workflow_name: mirrors
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
2022-05-02 17:08:52 +00:00
run: npm install -g pnpm@^6.24.2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Build zip
working-directory: plugins/woocommerce
run: bash bin/build-zip.sh
- name: Upload the zip file as an artifact
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: woocommerce
path: plugins/woocommerce/woocommerce.zip
retention-days: 7
mirror:
2022-02-17 21:16:32 +00:00
if: github.repository == 'woocommerce/woocommerce'
name: Push to Mirror
needs: [build]
runs-on: ubuntu-20.04
steps:
- name: Create directories
run: |
mkdir -p tmp/woocommerce-build
mkdir -p monorepo
- name: Checkout monorepo
uses: actions/checkout@v3
with:
path: monorepo
- name: Download WooCommerce ZIP
uses: actions/download-artifact@v3
with:
name: woocommerce
path: tmp/woocommerce-build
- 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
- name: Copy Composer over to production
2022-05-12 16:13:45 +00:00
run: cp monorepo/plugins/woocommerce/composer.json tmp/woocommerce-build/woocommerce/woocommerce-production
- name: Set up mirror
working-directory: tmp/woocommerce-build
run: |
touch mirrors.txt
echo "woocommerce/woocommerce-production" >> mirrors.txt
- 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.