Skip to content

Commit

Permalink
Merge branch 'trunk' into rnmobile/upgrade/0.69.4
Browse files Browse the repository at this point in the history
  • Loading branch information
derekblank committed Nov 15, 2022
2 parents 56f2696 + 36b6a19 commit 3e15b34
Show file tree
Hide file tree
Showing 267 changed files with 6,395 additions and 3,360 deletions.
11 changes: 6 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ module.exports = {
'partial',
'partialRight',
'random',
'reduce',
'reject',
'repeat',
'reverse',
Expand Down Expand Up @@ -327,12 +328,12 @@ module.exports = {
extends: [ 'plugin:@wordpress/eslint-plugin/test-unit' ],
},
{
files: [ '**/test/**/*.js' ],
files: [ '**/test/**/*.[tj]s?(x)' ],
excludedFiles: [
'**/*.@(android|ios|native).js',
'packages/react-native-*/**/*.js',
'test/native/**/*.js',
'test/e2e/**/*.[tj]s',
'**/*.@(android|ios|native).[tj]s?(x)',
'packages/react-native-*/**/*.[tj]s?(x)',
'test/native/**/*.[tj]s?(x)',
'test/e2e/**/*.[tj]s?(x)',
],
extends: [
'plugin:jest-dom/recommended',
Expand Down
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ updates:
schedule:
interval: 'daily'
open-pull-requests-limit: 10
labels:
- 'GitHub Actions'
- 'Automated Testing'
- '[Type] Build Tooling'
18 changes: 9 additions & 9 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
"https://api.github.com/repos/${{ github.repository }}/releases/latest"
LATEST_STABLE_TAG=$(jq --raw-output '.tag_name' latest.json)
IFS='.' read LATEST_STABLE_MAJOR LATEST_STABLE_MINOR LATEST_STABLE_PATCH <<< "${LATEST_STABLE_TAG#v}"
echo "::set-output name=current_stable_branch::release/${LATEST_STABLE_MAJOR}.${LATEST_STABLE_MINOR}"
echo "current_stable_branch=release/${LATEST_STABLE_MAJOR}.${LATEST_STABLE_MINOR}" >> $GITHUB_OUTPUT
if [[ ${LATEST_STABLE_MINOR} == "9" ]]; then
echo "::set-output name=next_stable_branch::release/$((LATEST_STABLE_MAJOR + 1)).0"
echo "next_stable_branch=release/$((LATEST_STABLE_MAJOR + 1)).0" >> $GITHUB_OUTPUT
else
echo "::set-output name=next_stable_branch::release/${LATEST_STABLE_MAJOR}.$((LATEST_STABLE_MINOR + 1))"
echo "next_stable_branch=release/${LATEST_STABLE_MAJOR}.$((LATEST_STABLE_MINOR + 1))" >> $GITHUB_OUTPUT
fi
bump-version:
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
id: get_version
run: |
OLD_VERSION=$(jq --raw-output '.version' package.json)
echo "::set-output name=old_version::$(echo $OLD_VERSION)"
echo "old_version=${OLD_VERSION}" >> $GITHUB_OUTPUT
if [[ ${{ github.event.inputs.version }} == 'stable' ]]; then
NEW_VERSION=$(npx semver $OLD_VERSION -i patch)
else
Expand All @@ -93,10 +93,10 @@ jobs:
fi
fi
fi
echo "::set-output name=new_version::$(echo $NEW_VERSION)"
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
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)"
echo "release_branch=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT
- name: Configure git user name and email
run: |
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
git add gutenberg.php package.json package-lock.json
git commit -m "Bump plugin version to ${{ steps.get_version.outputs.new_version }}"
git push --set-upstream origin "${{ steps.get_version.outputs.release_branch }}"
echo "::set-output name=version_bump_commit::$(git rev-parse --verify --short HEAD)"
echo "version_bump_commit=$(git rev-parse --verify --short HEAD)" >> $GITHUB_OUTPUT
- name: Fetch trunk
if: ${{ github.ref != 'refs/heads/trunk' }}
Expand All @@ -146,7 +146,7 @@ jobs:
if [[ ${{ steps.get_version.outputs.old_version }} == "$TRUNK_VERSION" ]]; then
git cherry-pick "${{ steps.get_version.outputs.release_branch }}"
git push
echo "::set-output name=version_bump_commit::$(git rev-parse --verify --short HEAD)"
echo "version_bump_commit=$(git rev-parse --verify --short HEAD)" >> $GITHUB_OUTPUT
fi
build:
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
id: get_release_version
env:
VERSION: ${{ needs.bump-version.outputs.new_version }}
run: echo ::set-output name=version::$(echo $VERSION | cut -d / -f 3 | sed 's/-rc./ RC/' )
run: echo "version=$(echo $VERSION | cut -d / -f 3 | sed 's/-rc./ RC/' )" >> $GITHUB_OUTPUT

- name: Download Plugin Zip Artifact
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}

- uses: reactivecircus/android-emulator-runner@d7b53ddc6e44254e1f4cf4a6ad67345837027a66 # v2.26.0
- uses: reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 # v2.27.0
with:
api-level: 28
emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160#issuecomment-868615730
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upload-release-to-plugin-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: |
IFS='.' read -r -a VERSION_ARRAY <<< "${TAG#v}"
RELEASE_BRANCH="release/${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}"
echo "::set-output name=release_branch::$(echo $RELEASE_BRANCH)"
echo "release_branch=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT
update-changelog:
name: Update Changelog on ${{ matrix.branch }} branch
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:

- name: Get previous stable version
id: get_previous_stable_version
run: echo ::set-output name=stable_version::$(awk -F ':\ ' '$1 == "Stable tag" {print $2}' ./trunk/readme.txt)
run: echo "stable_version=$(awk -F ':\ ' '$1 == "Stable tag" {print $2}' ./trunk/readme.txt)" >> $GITHUB_OUTPUT

- name: Delete everything
working-directory: ./trunk
Expand Down
60 changes: 6 additions & 54 deletions bin/plugin/commands/common.js
Original file line number Diff line number Diff line change
@@ -1,72 +1,26 @@
/**
* External dependencies
*/
const fs = require( 'fs' );
const rimraf = require( 'rimraf' );
const semver = require( 'semver' );
const SimpleGit = require( 'simple-git' );

/**
* Internal dependencies
*/
const { log, formats } = require( '../lib/logger' );
const { runStep, readJSONFile } = require( '../lib/utils' );
const git = require( '../lib/git' );
const config = require( '../config' );

/**
* Clone the repository and returns the working directory.
*
* @param {string} abortMessage Abort message.
*
* @return {Promise<string>} Repository local path.
*/
async function runGitRepositoryCloneStep( abortMessage ) {
// Cloning the repository.
let gitWorkingDirectoryPath;
await runStep( 'Cloning the Git repository', abortMessage, async () => {
log( '>> Cloning the Git repository' );
gitWorkingDirectoryPath = await git.clone( config.gitRepositoryURL );
log(
'>> The Git repository has been successfully cloned in the following temporary folder: ' +
formats.success( gitWorkingDirectoryPath )
);
} );

return gitWorkingDirectoryPath;
}

/**
* Clean the working directories.
*
* @param {string[]} folders Folders to clean.
* @param {string} abortMessage Abort message.
*/
async function runCleanLocalFoldersStep( folders, abortMessage ) {
await runStep( 'Cleaning the temporary folders', abortMessage, async () => {
await Promise.all(
folders.map( async ( directoryPath ) => {
if ( fs.existsSync( directoryPath ) ) {
await rimraf( directoryPath, ( err ) => {
if ( err ) {
throw err;
}
} );
}
} )
);
} );
}
const { readJSONFile } = require( '../lib/utils' );

/**
* Finds the name of the current plugin release branch based on the version in
* the package.json file.
* the package.json file and the latest `trunk` branch in `git`.
*
* @param {string} gitWorkingDirectoryPath Path to the project's working directory.
*
* @return {string} Name of the plugin release branch.
*/
async function findPluginReleaseBranchName( gitWorkingDirectoryPath ) {
await git.checkoutRemoteBranch( gitWorkingDirectoryPath, 'trunk' );
await SimpleGit( gitWorkingDirectoryPath )
.fetch( 'origin', 'trunk' )
.checkout( 'trunk' );

const packageJsonPath = gitWorkingDirectoryPath + '/package.json';
const mainPackageJson = readJSONFile( packageJsonPath );
Expand Down Expand Up @@ -141,6 +95,4 @@ function calculateVersionBumpFromChangelog(
module.exports = {
calculateVersionBumpFromChangelog,
findPluginReleaseBranchName,
runGitRepositoryCloneStep,
runCleanLocalFoldersStep,
};
Loading

0 comments on commit 3e15b34

Please sign in to comment.