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

[For dev: update with main] Issue #535: Change multidev deploy to manual only: tag based #670

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ee1f0d3
Issue #535: Use workflow_dispatch
leonel-lullabot Apr 24, 2024
8801947
Issue #535: Remove workflow_dispatch
leonel-lullabot Apr 29, 2024
f57c15e
Issue #535: Use labels to run the Multidev deploy
leonel-lullabot Apr 29, 2024
6dd5bd5
Issue #535: Fix elseif
leonel-lullabot Apr 29, 2024
74fe0e3
Issue #535: Code Refactor
leonel-lullabot Apr 30, 2024
778a0a0
Issue #535: Code Refactor
leonel-lullabot Apr 30, 2024
c251e46
Issue #535: Use pull_request
leonel-lullabot May 2, 2024
944c0d8
Issue #535: Remove extra parentheses
leonel-lullabot May 6, 2024
67f22e9
Merge branch 'main' into 535--change-multidev-deploy-to-manual-only
YesCT May 8, 2024
23f9bdb
Merge remote-tracking branch 'origin' into 535--change-multidev-deplo…
leonel-lullabot May 15, 2024
37e5e6e
Issue #535: Add opened, synchronize, and reopened
leonel-lullabot May 16, 2024
1ebab28
Merge remote-tracking branch 'origin' into 535--change-multidev-deplo…
leonel-lullabot May 16, 2024
1bc0f5b
Issue #535: Code Refactor
leonel-lullabot May 16, 2024
2ff1061
Issue #535: Code Refactor
leonel-lullabot May 16, 2024
468b177
Issue #535: Code Refactor
leonel-lullabot May 16, 2024
d87182e
Merge remote-tracking branch 'origin' into 535--change-multidev-deplo…
leonel-lullabot May 21, 2024
722a25e
Merge tag 'v3.10.0' into 535--change-multidev-deploy-to-manual-only
leonel-lullabot Aug 26, 2024
ab80299
remove unlabeled. seems like a copy and paste, since this PR is about…
YesCT Aug 28, 2024
bdb4ce6
Merge branch 'main' into 535--change-multidev-deploy-to-manual-only-d…
YesCT Aug 28, 2024
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
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')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if: contains(github.event.pull_request.labels.*.name, 'pantheon-multidev')
if: (contains(github.event.pull_request.labels.*.name, 'pantheon-multidev') && ${{ vars.PANTHEON_MULTIDEV_MANUAL }} == "true") || ${{ vars.PANTHEON_MULTIDEV_MANUAL }} != "true"

From justafish

Could we do something like that instead of duplicating the files? (haven't tested it so not sure if it'll work!)

#546 (comment)

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 @@ -318,15 +318,17 @@ private function installGitHubActions(string $scaffoldPath): 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