Skip to content

Commit

Permalink
Merge changes published in the Gutenberg plugin "release/10.3" branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Apr 2, 2021
1 parent 65bd554 commit cda58be
Show file tree
Hide file tree
Showing 681 changed files with 14,071 additions and 8,708 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
- [ ] I've tested my changes with keyboard and screen readers. <!-- Instructions: https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/accessibility-testing.md -->
- [ ] My code has proper inline documentation. <!-- Guidelines: https://developer.wordpress.org/coding-standards/inline-documentation-standards/javascript/ -->
- [ ] I've included developer documentation if appropriate. <!-- Handbook: https://developer.wordpress.org/block-editor/ -->
- [ ] I've updated all React Native files affected by any refactorings/renamings in this PR. <!-- React Native mobile Gutenberg guidelines: https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/native-mobile.md -->
- [ ] I've updated all React Native files affected by any refactorings/renamings in this PR. <!-- React Native mobile Gutenberg guidelines: https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/code/native-mobile.md -->
149 changes: 132 additions & 17 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,113 @@ name: Build Gutenberg Plugin Zip

on:
pull_request:
paths-ignore:
- '**.md'
push:
branches: [trunk]
tags:
- 'v*'
paths-ignore:
- '**.md'
workflow_dispatch:
inputs:
version:
description: 'rc or stable?'
required: true

jobs:
bump-version:
name: Bump version
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' &&
github.ref == 'refs/heads/trunk' && (
github.event.inputs.version == 'rc' ||
github.event.inputs.version == 'stable'
)
outputs:
old_version: ${{ steps.get_version.outputs.old_version }}
new_version: ${{ steps.get_version.outputs.new_version }}
release_branch: ${{ steps.get_version.outputs.release_branch }}
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
token: ${{ secrets.GUTENBERG_TOKEN }}

- name: Compute old and new version
id: get_version
run: |
OLD_VERSION=$(jq --raw-output '.version' package.json)
echo "::set-output name=old_version::$(echo $OLD_VERSION)"
if [[ ${{ github.event.inputs.version }} == 'stable' ]]; then
NEW_VERSION=$(npx semver $OLD_VERSION -i patch)
else
if [[ $OLD_VERSION == *"rc"* ]]; then
NEW_VERSION=$(npx semver $OLD_VERSION -i prerelease)
else
# WordPress version guidelines: If minor is 9, bump major instead.
IFS='.' read -r -a OLD_VERSION_ARRAY <<< "$OLD_VERSION"
if [[ ${OLD_VERSION_ARRAY[1]} == "9" ]]; then
NEW_VERSION="$(npx semver $OLD_VERSION -i major)-rc.1"
else
NEW_VERSION="$(npx semver $OLD_VERSION -i minor)-rc.1"
fi
fi
fi
echo "::set-output name=new_version::$(echo $NEW_VERSION)"
IFS='.' read -r -a NEW_VERSION_ARRAY <<< "$NEW_VERSION"
RELEASE_BRANCH="release/${NEW_VERSION_ARRAY[0]}.${NEW_VERSION_ARRAY[1]}"
echo "::set-output name=release_branch::$(echo $RELEASE_BRANCH)"
- name: Configure git user name and email
run: |
git config user.name "Gutenberg Repository Automation"
git config user.email gutenberg@wordpress.org
- name: Create and switch to release branch
if: |
github.event.inputs.version == 'rc' &&
! contains( steps.get_version.outputs.old_version, 'rc' )
run: git checkout -b "${{ steps.get_version.outputs.release_branch }}"

- name: Switch to release branch
if: |
github.event.inputs.version == 'stable' ||
contains( steps.get_version.outputs.old_version, 'rc' )
run: |
git fetch --depth=1 origin "${{ steps.get_version.outputs.release_branch }}"
git checkout "${{ steps.get_version.outputs.release_branch }}"
- name: Update plugin version
env:
VERSION: ${{ steps.get_version.outputs.new_version }}
run: |
cat <<< $(jq --tab --arg version "${VERSION}" '.version = $version' package.json) > package.json
cat <<< $(jq --tab --arg version "${VERSION}" '.version = $version' package-lock.json) > package-lock.json
sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" gutenberg.php
sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" readme.txt
- name: Commit the version bump
run: |
git add gutenberg.php package.json package-lock.json readme.txt
git commit -m "Bump plugin version to ${{ steps.get_version.outputs.new_version }}"
git push --set-upstream origin "${{ steps.get_version.outputs.release_branch }}"
- name: Cherry-pick to trunk
run: |
git checkout trunk
TRUNK_VERSION=$(jq --raw-output '.version' package.json)
if [[ ${{ steps.get_version.outputs.old_version }} == "$TRUNK_VERSION" ]]; then
git cherry-pick "${{ steps.get_version.outputs.release_branch }}"
git push
fi
build:
name: Build Release Artifact
runs-on: ubuntu-latest
needs: bump-version
if: always()
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
ref: ${{ needs.bump-version.outputs.release_branch || github.ref }}

- name: Cache node modules
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
Expand Down Expand Up @@ -48,38 +139,62 @@ jobs:
name: gutenberg-plugin
path: ./gutenberg.zip

- name: Build release notes draft
if: ${{ needs.bump-version.outputs.new_version }}
env:
VERSION: ${{ needs.bump-version.outputs.new_version }}
run: |
IFS='.' read -r -a VERSION_ARRAY <<< "${VERSION}"
MILESTONE="Gutenberg ${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}"
npm run changelog -- --milestone="$MILESTONE" --unreleased > release-notes.txt
sed -ie '1,6d' release-notes.txt
if [[ ${{ needs.bump-version.outputs.new_version }} != *"rc"* ]]; then
# Include previous RCs' release notes, if any
CHANGELOG_REGEX="=\s[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?\s="
RC_REGEX="=\s${VERSION}(-rc\.[0-9]+)?\s="
awk "/${RC_REGEX}/ {found=1;print;next} /${CHANGELOG_REGEX}/ {found=0} found" changelog.txt >> release-notes.txt
fi
- name: Upload release notes artifact
if: ${{ needs.bump-version.outputs.new_version }}
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
with:
name: release-notes
path: ./release-notes.txt

create-release:
name: Create Release Draft and Attach Asset
needs: build
needs: [bump-version, build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Set Release Version
id: get_release_version
run: echo ::set-output name=version::$(echo $GITHUB_REF | cut -d / -f 3 | sed s/^v// | sed 's/-rc./ RC/' )
env:
VERSION: ${{ needs.bump-version.outputs.new_version }}
run: echo ::set-output name=version::$(echo $VERSION | cut -d / -f 3 | sed 's/-rc./ RC/' )

- name: Download Plugin Zip Artifact
uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8
with:
name: gutenberg-plugin

- name: Extract Changelog for Release
run: |
unzip gutenberg.zip changelog.txt
CHANGELOG_REGEX="/=\s[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?\s=/"
awk -i inplace "$CHANGELOG_REGEX"'{p++;next} p==2{exit} p>=1' changelog.txt
- name: Download Release Notes Artifact
uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8
with:
name: release-notes

- name: Create Release Draft
id: create_release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
tag_name: "v${{ needs.bump-version.outputs.new_version }}"
release_name: ${{ steps.get_release_version.outputs.version }}
commitish: ${{ needs.bump-version.outputs.release_branch || github.ref }}
draft: true
prerelease: ${{ contains(github.ref, 'rc') }}
body_path: changelog.txt
prerelease: ${{ contains(needs.bump-version.outputs.new_version, 'rc') }}
body_path: release-notes.txt

- name: Upload Release Asset
id: upload-release-asset
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/create-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@ name: Create Block

on:
pull_request:
paths:
- 'packages/**'
- '!packages/**/test/**'
- '!packages/**/*.md'
push:
branches: [trunk, wp/trunk]
paths:
- 'packages/**'
- '!packages/**/test/**'
- '!packages/**/*.md'

jobs:
checks:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ name: End-to-End Tests

on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- trunk
- 'wp/**'
paths-ignore:
- '**.md'

jobs:
admin:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Performances Tests

on:
pull_request:
paths-ignore:
- '**.md'
release:
types: [created]

Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ name: React Native E2E Tests (Android)

on:
pull_request:
paths-ignore:
- '**.md'
push:
branches: [trunk]
paths-ignore:
- '**.md'

jobs:
test:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ name: React Native E2E Tests (iOS)

on:
pull_request:
paths-ignore:
- '**.md'
push:
branches: [trunk]
paths-ignore:
- '**.md'

jobs:
test:
Expand Down Expand Up @@ -38,7 +34,9 @@ jobs:
- name: Restore build cache
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
with:
path: packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app
path: |
packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app
packages/react-native-editor/ios/build/WDA
key: ${{ runner.os }}-ios-build-${{ matrix.xcode }}-${{ hashFiles('ios-checksums.txt') }}

- name: Restore pods cache
Expand All @@ -65,6 +63,9 @@ jobs:
- name: Build (if needed)
run: test -e packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/GutenbergDemo || npm run native test:e2e:build-app:ios

- name: Build Web Driver Agent (if needed)
run: test -d packages/react-native-editor/ios/build/WDA || npm run native test:e2e:build-wda

- name: Run iOS Device Tests
run: TEST_RN_PLATFORM=ios npm run native device-tests:local ${{ matrix.native-test-name }}

Expand Down
Loading

0 comments on commit cda58be

Please sign in to comment.