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

Fixes to drainpipe-dev deployments #495

Merged
merged 24 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f14a9e4
Add workflow to drainpipe-dev to automatically create release on tags.
davereid Mar 22, 2024
a9e3976
Update drainpipe-dev workflow to push directly using deploy key.
davereid Mar 22, 2024
42934bb
Ensure release has a title.
davereid Mar 22, 2024
8d9ab41
Test on pull request to ensure it works.
davereid Mar 22, 2024
b9b5092
More testing for pull request.
davereid Mar 22, 2024
b441ec7
Fixing syntax.
davereid Mar 22, 2024
b4f46f6
Test on push not pull_request.
davereid Mar 22, 2024
dc6e044
Add a git branch call first.
davereid Mar 22, 2024
30841e3
Testing removing a file.
davereid Mar 22, 2024
08d3b3c
Add regular branch name to git reset.
davereid Mar 22, 2024
0ac016f
Revert "Testing removing a file."
davereid Mar 22, 2024
7b441f7
Test "Workaround" for 'quotes' in commit message.
davereid Mar 22, 2024
5fcf146
Test "Workaround" for 'quotes' in commit message.
davereid Mar 22, 2024
fa82901
Test renamed file.
davereid Mar 22, 2024
30717f0
Revert "Test renamed file."
davereid Mar 22, 2024
b28b4a0
Update to use application credentials.
davereid Mar 22, 2024
d28aeb1
Try to use signed commits.
davereid Mar 22, 2024
3069764
Revert "Try to use signed commits."
davereid Mar 22, 2024
c134a79
Ensure at least an empty commit is pushed before tag.
davereid Apr 9, 2024
229fcd8
Test empty commit.
davereid Apr 9, 2024
4d225c5
Remove test branch from workflow.
davereid Apr 9, 2024
fdb270d
Add lockdown workflow for drainpipe-dev.
davereid Apr 9, 2024
fde3475
Update repo-lockdown.yml
davereid Apr 10, 2024
291011a
Update .github/workflows/DrainpipeDev.yml
davereid Apr 10, 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: 41 additions & 31 deletions .github/workflows/DrainpipeDev.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,60 @@
name: "Push Drainpipe Dev Package"
name: Push Drainpipe Dev Package

on:
push:
branches:
- 460-drainpipe-dev-use-deploy-token
- main
davereid marked this conversation as resolved.
Show resolved Hide resolved
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref_name || github.sha }}
cancel-in-progress: false
davereid marked this conversation as resolved.
Show resolved Hide resolved

davereid marked this conversation as resolved.
Show resolved Hide resolved
permissions:
contents: read

jobs:
Drainpipe-Dev:
runs-on: ubuntu-22.04
name: Push branch to drainpipe-dev
runs-on: ubuntu-latest
steps:

- name: Create a Drupal project
run: composer create-project drupal/recommended-project . --ignore-platform-req=ext-gd

- uses: actions/checkout@v4
with:
path: drainpipe

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

- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
- name: Add drainpipe-dev deploy key in order to run git clone
uses: webfactory/ssh-agent@v0.9.0
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
ssh-private-key: ${{ secrets.DRAINPIPE_DEV_DEPLOY_KEY }}
log-public-key: false

- name: Setup Project
# Commits made by the https://github.com/apps/lullabot-drainpipe application.
# @see https://github.com/orgs/community/discussions/24664
- name: Create git checkout of drainpipe-dev
working-directory: drainpipe-dev
run: |
git init
git branch -m ${{ github.ref_name }}
git remote add origin git@github.com:Lullabot/drainpipe-dev.git
git fetch origin
git reset --mixed origin/${{ github.ref_name }}
git config user.name "Lullabot-Drainpipe[bot]"
git config user.email "157769597+Lullabot-Drainpipe[bot]@users.noreply.github.com"

- name: Push branch to drainpipe-dev
if: ${{ startsWith(github.ref, 'refs/heads/') }}
working-directory: drainpipe-dev
run: |
git add -A
git commit -m "$COMMIT_MESSAGE" --allow-empty
git push origin ${{ github.ref_name }}
davereid marked this conversation as resolved.
Show resolved Hide resolved
env:
# Workaround if the commit message contains quotes.
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}

- name: Push tag to drainpipe-dev
if: ${{ startsWith(github.ref, 'refs/tags/') }}
working-directory: drainpipe-dev
run: |
ddev config --auto
ddev start
ddev composer config extra.drupal-scaffold.gitignore true
ddev composer config --json extra.drupal-scaffold.allowed-packages \[\"lullabot/drainpipe\"]
ddev composer config --no-plugins allow-plugins.composer/installers true
ddev composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe true
ddev composer config repositories.drainpipe --json '{"type": "path", "url": "drainpipe", "options": {"symlink": false}}'
ddev composer config minimum-stability dev
ddev composer require lullabot/drainpipe --with-all-dependencies

- name: Push drainpipe-dev
run: ddev exec "./vendor/bin/task deploy:git directory=/var/www/html/drainpipe/drainpipe-dev branch=${{ github.ref_name }} remote=https://${{ secrets.DRAINPIPE_DEV_GITHUB_TOKEN_USERNAME }}:${{ secrets.DRAINPIPE_DEV_GITHUB_TOKEN }}@github.com/lullabot/drainpipe-dev.git message=\"${{ github.event.head_commit.message }}\""
git tag ${{ github.ref_name }}
git push origin ${{ github.ref_name }}
27 changes: 27 additions & 0 deletions drainpipe-dev/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
push:
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.sha }}
cancel-in-progress: false

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create release
run: |
gh release create ${{ github.ref_name }} \
--title "${{ github.ref_name }}" \
--notes "See https://github.com/Lullabot/drainpipe/releases/tag/${{ github.ref_name }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading