-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into add/skip-link
- Loading branch information
Showing
852 changed files
with
19,397 additions
and
10,978 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected] | ||
- 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 | ||
|
@@ -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 | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ name: Performances Tests | |
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
release: | ||
types: [created] | ||
|
||
|
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
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
Oops, something went wrong.