-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add action to deploy to Pantheon
Signed-off-by: Souptik Datta <[email protected]>
- Loading branch information
1 parent
f25b0ea
commit f8a6b8e
Showing
3 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
set -x | ||
set -euo pipefail | ||
|
||
# Add SSH Key | ||
eval $(ssh-agent -s) | ||
ssh-agent -a /tmp/ssh_agent.sock > /dev/null | ||
echo "$PANTHEON_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null | ||
mkdir -p ~/.ssh && echo "StrictHostKeyChecking no" >> ~/.ssh/config | ||
|
||
# Git Config | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Deploy" | ||
|
||
# Clone Pantheon Repo | ||
git clone --single-branch --branch $PANTHEON_GIT_BRANCH $PANTHEON_GIT_REPOSITORY $HOME/pantheon-deploy --depth 1 | ||
cd $HOME/pantheon-deploy | ||
|
||
# Copy Plugins | ||
rm -rf wp-content/plugins | ||
cp -r $GITHUB_WORKSPACE/backend/plugins wp-content | ||
|
||
# Copy Themes | ||
rm -rf wp-content/themes | ||
mv $GITHUB_WORKSPACE/backend/themes wp-content | ||
|
||
# Check if we have changes | ||
if [[ -z $(git status -s) ]]; then | ||
# No changes | ||
echo "No changes to push" | ||
else | ||
# Push changes to Pantheon | ||
git add . | ||
git status | ||
git commit -m "Deploy from GitHub $GITHUB_SHA" | ||
git push origin $PANTHEON_GIT_BRANCH | ||
fi | ||
|
||
set +x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Backend Deploy | ||
|
||
concurrency: backend | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
env: | ||
COMPOSER_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: backend | ||
|
||
steps: | ||
- name: Checkout to repository. | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: './backend/plugins/souptik2001/.nvmrc' | ||
|
||
- name: Install WordPress plugins | ||
run: | | ||
composer install --working-dir=backend | ||
- name: Build the souptik2001 plugin's assets | ||
run: cd backend/plugins/souptik2001 && npm ci && npm run build && rm -rf node_modules | ||
|
||
- name: Deploy to Pantheon | ||
env: | ||
PANTHEON_SSH_PRIVATE_KEY: ${{ secrets.PANTHEON_SSH_PRIVATE_KEY }} | ||
PANTHEON_GIT_REPOSITORY: ${{ secrets.PANTHEON_GIT_REPOSITORY }} | ||
PANTHEON_GIT_BRANCH: master | ||
RELEASE_VERSION: ${{ github.ref_name }} | ||
run: bash .bin/deploy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f8a6b8e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
souptik2001-github-io – ./
souptik2001-github-io.vercel.app
souptik2001-github-io-git-master-souptik2001.vercel.app
souptik2001-github-io-souptik2001.vercel.app
www.souptik.dev
souptik.dev