Skip to content

Commit

Permalink
Small improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolad committed Feb 9, 2021
1 parent 552aee4 commit ba305f4
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 16 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,21 @@ jobs:
- name: Setup Playwright
uses: microsoft/playwright-github-action@v1

- name: Check out event-espresso-core
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675
env:
GIT_TRACE: 1
GIT_CURL_VERBOSE: 1
with:
repository: eventespresso/event-espresso-core
path: event-espresso-core
persist-credentials: true
ref: dev
token: ${{ secrets.GH_ACTIONS_ACCESS_TOKEN }}
# - name: Check out event-espresso-core
# uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675
# env:
# GIT_TRACE: 1
# GIT_CURL_VERBOSE: 1
# with:
# repository: eventespresso/event-espresso-core
# path: event-espresso-core
# persist-credentials: true
# ref: dev
# token: ${{ secrets.GH_ACTIONS_ACCESS_TOKEN }}

# Deploy the built assets to core repo's assets/dist
- name: Deploy to event-espresso-core
run: source tools/deploy-test.sh "event-espresso-core" "dev"

- name: Running the tests
run: yarn test:e2e
Expand Down
2 changes: 1 addition & 1 deletion domains/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"react-select": "^4.0.2"
},
"devDependencies": {
"@types/react-select": "^3.1.2",
"@types/react-select": "^4.0.13",
"@types/wordpress__block-editor": "^2.2.9",
"@types/wordpress__components": "^9.8.6",
"@types/wordpress__i18n": "^3.11.0"
Expand Down
88 changes: 88 additions & 0 deletions tools/deploy-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

################################### INSTRUCTIONS ########################################
# This script accepts upto 5 arguments #
#---------------------------------------------------------------------------------------#
# # | Description | REQUIRED | DEFAULT #
#---------------------------------------------------------------------------------------#
# 1 | target repository name e.g. "event-espresso-core" | YES | - #
# 2 | branch to deploy at, in the target repository | NO | "dev" #
# 3 | username of the target repository | NO | "eventespresso" #
# 4 | build path on the current/this repository | NO | "build" #
# 5 | path to assets folder on the target repository | NO | "assets" #
#########################################################################################

##################################### EXAMPLES ##########################################
# ./deploy.sh "event-espresso-core" #
# ./deploy.sh "event-espresso-core" "dev" #
# ./deploy.sh "event-espresso-core" "dev" "eventespresso" #
# ./deploy.sh "event-espresso-core" "dev" "eventespresso" "build" #
# ./deploy.sh "event-espresso-core" "dev" "eventespresso" "build" "assets/dist" #
#########################################################################################

##################### ENV VARIABLES THAT SHOULD ALREADY BE SET ########################
#-------------------------------------------------------------------------------------#
# Name | Description #
#-------------------------------------------------------------------------------------#
# API_TOKEN_GITHUB | Github access token #
# GIT_USER_EMAIL | Email of the git user to use for commits #
# GIT_USER_NAME | Name of the git user to use for commits #
#######################################################################################

####################### DEFAULT ENV VARIABLES SET BY GITHUB ###########################
# @link https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
# 1. GITHUB_REPOSITORY
# 2. GITHUB_SHA

set -e

# name of the repo e.g. "event-espresso-core"
REPO=$1
# The target repo branch
BRANCH="${2:-dev}"
# Convert "refs/heads/dev" to "dev"
BRANCH="${BRANCH#refs/heads/}"
# GitHub account username
USERNAME="${3:-eventespresso}"
# Default path to build folder
BUILD_PATH="${4:-build}"
# Default path to assets folder (on target repo)
ASSETS_PATH="${5:-assets}"
# This repo
THIS="${5:-assets/dist}"

BASE=$(pwd)

# the source commit SHA with repo URL
SOURCE_COMMIT="${GITHUB_REPOSITORY}@${GITHUB_SHA}"

git config --global user.email "$GIT_USER_EMAIL"
git config --global user.name "$GIT_USER_NAME"

echo " Repo: $REPO"
CLONE_DIR="__${REPO}__clone__"
echo " Clone dir: $CLONE_DIR"

# make sure the directory is empty
rm -rf $CLONE_DIR/*

# clone the repo branch
git clone -b $BRANCH https://$API_TOKEN_GITHUB@github.com/$USERNAME/$REPO.git $CLONE_DIR

# goto the repo directory
cd $CLONE_DIR

# clean the assets path.
echo "Clean up assets path..."
rm -rf $ASSETS_PATH/static/*
rm -f $ASSETS_PATH/asset-manifest.json

# Make sure the directory exists
mkdir -p $ASSETS_PATH

# copy files from build folder to target assets folder
echo "Copy build files to assets path..."
cp -r $BASE/$BUILD_PATH/* $ASSETS_PATH/

# go back to base directory
cd $BASE
9 changes: 5 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4786,11 +4786,12 @@
"@types/draft-js" "*"
"@types/react" "*"

"@types/react-select@^3.1.2":
version "3.1.2"
resolved "https://registry.yarnpkg.com/@types/react-select/-/react-select-3.1.2.tgz#38627df4b49be9b28f800ed72b35d830369a624b"
integrity sha512-ygvR/2FL87R2OLObEWFootYzkvm67LRA+URYEAcBuvKk7IXmdsnIwSGm60cVXGaqkJQHozb2Cy1t94tCYb6rJA==
"@types/react-select@^4.0.13":
version "4.0.13"
resolved "https://registry.yarnpkg.com/@types/react-select/-/react-select-4.0.13.tgz#8d2c41a0df7fbf67ab0b995797b0e9b4e6b38cde"
integrity sha512-rXYEc565IzzjgQzs9C0YCFxV/QajMZnCHG5QwRQ5BZMfH0Lj90VI/xohawemRkD46IvpaLRbO6xzSquJlgBGUA==
dependencies:
"@emotion/serialize" "^1.0.0"
"@types/react" "*"
"@types/react-dom" "*"
"@types/react-transition-group" "*"
Expand Down

0 comments on commit ba305f4

Please sign in to comment.