From ec5e05502d3f187d2832c8e43bef52f396059bff Mon Sep 17 00:00:00 2001 From: Miriam Goldman Date: Mon, 29 Jul 2024 14:16:16 -0400 Subject: [PATCH 1/4] tweak for branch name --- .github/workflows/standard-workflow.yml | 38 +++++++++++++++++-------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/standard-workflow.yml b/.github/workflows/standard-workflow.yml index 4861e9a36..145d455b7 100644 --- a/.github/workflows/standard-workflow.yml +++ b/.github/workflows/standard-workflow.yml @@ -72,9 +72,6 @@ jobs: deploy_to_pantheon: runs-on: ubuntu-latest needs: [ identify_sites, configure_env ] - # strategy: - # matrix: - # site: ${{ fromJSON(needs.identify_sites.outputs.sites) }} steps: - name: Checkout uses: actions/checkout@v4 @@ -95,10 +92,16 @@ jobs: - name: Determine target environment for deploy run: | - # Identify environment based on branch name - env=${{ github.ref_name }} - if [ "$env" == "master" ]; then - env="dev" + # Determine the environment name based on the event type + if [ "${{ github.event_name }}" = "pull_request" ]; then + # Use the PR number as the environment name + env=$(echo ${{ github.ref_name }} | sed 's|^\([0-9]*\)/.*|pr-\1|') + else + # Use the branch name as the environment name + env=${{ github.ref_name }} + if [ "$env" == "master" ]; then + env="dev" + fi fi # Ensure environment name is 11 characters or less and has no special characters @@ -112,7 +115,7 @@ jobs: run: | # Create multidev environment if it doesn't exist if ! terminus env:list ${{ vars.SITE_NAME }} --field=ID | grep $env; then - terminus env:create ${{ vars.SITE_NAME }}.dev $env + terminus env:create ${{ vars.SITE_NAME }}.live $env fi # Ensure environment is in git mode @@ -120,17 +123,28 @@ jobs: - name: Push branch to Pantheon run: | + curr_branch=$( git branch --show-current ) # The dev environment is always based on the master branch - branch=$( [ "$env" == "dev" ] && echo "master" || echo "$env" ) + dest_branch=$( [ "$env" == "dev" ] && echo "master" || echo "$env" ) + + if [[ ${{ github.event_name }} == 'pull_request' ]]; then + git checkout ${{ github.head_ref }} + fi # Configure git to use the SSH key and avoid host key checking git config --local core.sshCommand 'ssh -i ~/.ssh/pantheon -o StrictHostKeyChecking=no' + git config --local user.email "gh-actions@pantheon.io" + git config --local user.name "GitHub Actions" + git remote add pantheon $(terminus connection:info ${{ vars.SITE_NAME }}.$env --field=git_url) - git fetch --all - git push pantheon ${{ github.ref_name }}:$branch --force + git fetch pantheon + git checkout -b $dest_branch + git pull pantheon $dest_branch --rebase + git status + git push pantheon $dest_branch spin_down: - name: Spin down environment + name: Spin down needs: deploy_to_pantheon if: always() runs-on: ubuntu-latest From 7227fcc55978680fc9a0a8682caabbdec20970c1 Mon Sep 17 00:00:00 2001 From: Miriam Goldman Date: Mon, 29 Jul 2024 14:17:23 -0400 Subject: [PATCH 2/4] tweak --- .github/workflows/standard-workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/standard-workflow.yml b/.github/workflows/standard-workflow.yml index 145d455b7..864b4ce23 100644 --- a/.github/workflows/standard-workflow.yml +++ b/.github/workflows/standard-workflow.yml @@ -1,3 +1,4 @@ +# Note, master is used in this case, please change to your default branch. name: Deploy to Pantheon on: push: From 3ea0c6b647774112eeef67fdbc660867152939a6 Mon Sep 17 00:00:00 2001 From: Miriam Goldman Date: Mon, 29 Jul 2024 14:28:29 -0400 Subject: [PATCH 3/4] fix --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index be76eaf3f..1b3bab7ae 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,6 @@ We will post more information about how this works but we recommend developers t If you would like to keep a separate set of configuration for local development, you can use a file called `wp-config-local.php`, which is already in our .gitignore file. -### 4. Enjoy! - -![alt](http://i.imgur.com/fzIeQBP.png, '') - ## Branches The `default` branch of this repository is where PRs are merged, and has [CI](https://github.com/pantheon-systems/WordPress/tree/default/.circleci) that copies `default` to `master` after removing the CI directories. This allows customers to clone from `master` and implement their own CI without needing to worry about potential merge conflicts. From 936e33884dc37ab8affa201795e0f8936a8da645 Mon Sep 17 00:00:00 2001 From: Miriam Goldman Date: Mon, 29 Jul 2024 14:32:01 -0400 Subject: [PATCH 4/4] tweak --- README.md | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/README.md b/README.md index 1b3bab7ae..e69de29bb 100644 --- a/README.md +++ b/README.md @@ -1,35 +0,0 @@ -# WordPress - -This is a WordPress repository configured to run on the [Pantheon platform](https://pantheon.io). - -Pantheon is website platform optimized and configured to run high performance sites with an amazing developer workflow. There is built-in support for features such as Varnish, Redis, Apache Solr, New Relic, Nginx, PHP-FPM, MySQL, PhantomJS and more.  - -## Getting Started - -### 1. Spin-up a site - -If you do not yet have a Pantheon account, you can create one for free. Once you've verified your email address, you will be able to add sites from your dashboard. Choose "WordPress" to use this distribution. - -### 2. Load up the site - -When the spin-up process is complete, you will be redirected to the site's dashboard. Click on the link under the site's name to access the Dev environment. - -![alt](http://i.imgur.com/2wjCj9j.png?1, '') - -### 3. Run the WordPress installer - -How about the WordPress database config screen? No need to worry about database connection information as that is taken care of in the background. The only step that you need to complete is the site information and the installation process will be complete. - -We will post more information about how this works but we recommend developers take a look at `wp-config.php` to get an understanding. - -![alt](http://i.imgur.com/4EOcqYN.png, '') - -If you would like to keep a separate set of configuration for local development, you can use a file called `wp-config-local.php`, which is already in our .gitignore file. - -## Branches - -The `default` branch of this repository is where PRs are merged, and has [CI](https://github.com/pantheon-systems/WordPress/tree/default/.circleci) that copies `default` to `master` after removing the CI directories. This allows customers to clone from `master` and implement their own CI without needing to worry about potential merge conflicts. - -## Custom Upstreams - -If you are using this repository as a starting point for a custom upstream, be sure to review the [documentation](https://pantheon.io/docs/create-custom-upstream#pull-in-core-from-pantheons-upstream) and pull the core files from the `master` branch.