Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[In Use: update with release] Issue #535: Change multidev deploy to manual only: tag based #546

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scaffold/github/actions/pantheon/review/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ runs:
drainpipe_exec "terminus aliases --only ${{ inputs.site-name }} --yes"
if [ "${{ inputs.run-installer }}" == "true" ]; then
drainpipe_exec "./vendor/bin/drush @${{ inputs.site-name }}.pr-$DRAINPIPE_PR_NUMBER --yes site:install --existing-config"
elif drainpipe_exec "./vendor/bin/task -l | grep '* update: ')"; then
elif drainpipe_exec "./vendor/bin/task -l | grep '* update: '"; then
drainpipe_exec "./vendor/bin/task update site=@${{ inputs.site-name }}.pr-$DRAINPIPE_PR_NUMBER"
else
drainpipe_exec "./vendor/bin/task drupal:update site=@${{ inputs.site-name }}.pr-$DRAINPIPE_PR_NUMBER"
Expand Down
72 changes: 72 additions & 0 deletions scaffold/github/workflows/PantheonReviewAppsManual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "Pantheon Review Apps"

on:
pull_request:
types: [ labeled, unlabeled, opened, synchronize, reopened]
YesCT marked this conversation as resolved.
Show resolved Hide resolved

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

# You will also need to add the secrets used below to Dependabot secrets
# if you want this to successfully run in auto-created PRs.
permissions:
deployments: write
contents: read
pull-requests: read

jobs:
Drainpipe-Deploy-Pantheon-Multidev:
if: contains(github.event.pull_request.labels.*.name, 'pantheon-multidev')
YesCT marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- uses: ./.github/actions/drainpipe/set-env

- uses: ./.github/actions/drainpipe/setup-git
with:
git-name: Drainpipe Bot
git-email: [email protected]

- uses: ./.github/actions/drainpipe/setup-ssh
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}

- uses: ./.github/actions/drainpipe/pantheon/setup-terminus
with:
pantheon-token: ${{ secrets.PANTHEON_TERMINUS_TOKEN }}
terminus-plugins: ${{ vars.TERMINUS_PLUGINS || secrets.TERMINUS_PLUGINS }}

- uses: php-actions/composer@v6

- name: Build Project
env:
directory: /tmp/release
run: |
composer install
task build
task snapshot:directory directory=/tmp/release

- name: Deploy Pantheon Review App
uses: ./.github/actions/drainpipe/pantheon/review
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
terminus-token: ${{ secrets.PANTHEON_TERMINUS_TOKEN }}
commit-message: ${{ github.sha }}
site-name: ${{ vars.PANTHEON_SITE_NAME || secrets.PANTHEON_SITE_NAME }}
lock-username: ${{ secrets.PANTHEON_REVIEW_USERNAME }}
lock-password: ${{ secrets.PANTHEON_REVIEW_PASSWORD }}
52 changes: 52 additions & 0 deletions scaffold/github/workflows/PantheonReviewAppsManualDDEV.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Pantheon Review Apps"

on:
pull_request:
types: [ labeled, unlabeled, opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
Drainpipe-Deploy-Pantheon-Multidev:
if: contains(github.event.pull_request.labels.*.name, 'pantheon-multidev')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.ddev/.drainpipe-composer-cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: ./.github/actions/drainpipe/set-env

- name: Install and Start DDEV
uses: ./.github/actions/drainpipe/ddev
with:
git-name: Drainpipe Bot
git-email: [email protected]
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}

- name: Build Project
env:
directory: /tmp/release
run: |
ddev composer install
ddev task build
ddev task snapshot:directory directory=/tmp/release

- name: Deploy Pantheon Review App
uses: ./.github/actions/drainpipe/pantheon/review
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
terminus-token: ${{ secrets.PANTHEON_TERMINUS_TOKEN }}
commit-message: ${{ github.sha }}
site-name: ${{ vars.PANTHEON_SITE_NAME || secrets.PANTHEON_SITE_NAME }}
lock-username: ${{ secrets.PANTHEON_REVIEW_USERNAME }}
lock-password: ${{ secrets.PANTHEON_REVIEW_PASSWORD }}
# set to "true" if you want to run the installer
run-installer: ${{ secrets.PANTHEON_REVIEW_RUN_INSTALLER }}
8 changes: 5 additions & 3 deletions src/ScaffoldInstallerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,17 @@ private function installCICommands(): void
$fs->ensureDirectoryExists('./.github/actions');
$fs->copy("$scaffoldPath/github/actions/common", './.github/actions/drainpipe');
foreach ($this->extra['drainpipe']['github'] as $github) {
if ($github === 'PantheonReviewApps') {
if ($github === 'PantheonReviewApps' || $github === 'PantheonReviewAppsManual') {
$fs->ensureDirectoryExists('./.github/actions/drainpipe/pantheon');
$fs->ensureDirectoryExists('./.github/workflows');
$fs->copy("$scaffoldPath/github/actions/pantheon", './.github/actions/drainpipe/pantheon');
$pantheon_review_apps = ($github === 'PantheonReviewApps') ? 'PantheonReviewApps' : 'PantheonReviewAppsManual';
if (file_exists('./.ddev/config.yaml')) {
$fs->copy("$scaffoldPath/github/workflows/PantheonReviewAppsDDEV.yml", './.github/workflows/PantheonReviewApps.yml');
$pantheon_review_apps_ddev = $pantheon_review_apps . 'DDEV';
$fs->copy("$scaffoldPath/github/workflows/$pantheon_review_apps_ddev.yml", './.github/workflows/PantheonReviewApps.yml');
}
else {
$fs->copy("$scaffoldPath/github/workflows/PantheonReviewApps.yml", './.github/workflows/PantheonReviewApps.yml');
$fs->copy("$scaffoldPath/github/workflows/$pantheon_review_apps.yml", './.github/workflows/PantheonReviewApps.yml');
}
}
else if ($github === 'ComposerLockDiff') {
Expand Down
Loading