forked from YahnisElsts/wp-update-server
-
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.
Merge pull request #248 from hostinger/feat/cd_cd
feat: Add CI/CD
- Loading branch information
Showing
4 changed files
with
89 additions
and
0 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,38 @@ | ||
name: Deploy code on remote host | ||
on: | ||
workflow_call: | ||
inputs: | ||
host: | ||
description: 'Host to deploy changes on' | ||
required: true | ||
type: string | ||
path: | ||
description: 'Path to webserver directory' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
run-php-tests: | ||
runs-on: fireactions-bnk-c2-m4 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup SSH agent | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.DEPLOY_PRIVATE_KEY }} | ||
- name: Deploy changes on ${{ inputs.host }} server | ||
run: | | ||
ssh -o StrictHostKeyChecking=no apache@${{ inputs.host }} << EOF | ||
set -e | ||
mkdir -p ${{ inputs.path }} | ||
cd ${{ inputs.path }} | ||
if [ ! -d "${{ inputs.path }}" ]; then | ||
git clone [email protected]:${{ github.repository }}.git | ||
fi | ||
git fetch origin | ||
git checkout ${{ github.sha }} | ||
chown apache:apache -R ${{ inputs.path }} | ||
EOF |
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,17 @@ | ||
name: Deploy master branch on remote host | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
|
||
concurrency: | ||
group: deploy-master | ||
|
||
jobs: | ||
deploy-master: | ||
uses: ./.github/workflows/deploy.yml | ||
with: | ||
host: fr-int-wpupdate.hostinger.io | ||
path: /var/www/html/master |
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,17 @@ | ||
name: Deploy master branch on remote host | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
|
||
concurrency: | ||
group: deploy-master | ||
|
||
jobs: | ||
deploy-master: | ||
uses: ./.github/workflows/deploy.yml | ||
with: | ||
host: fr-int-wpupdate.hostinger.io | ||
path: /var/www/html/master |
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,17 @@ | ||
name: Deploy staging branch on remote host | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- staging | ||
|
||
concurrency: | ||
group: deploy-staging | ||
|
||
jobs: | ||
deploy-staging: | ||
uses: ./.github/workflows/deploy.yml | ||
with: | ||
host: fr-int-wpupdate.hostinger.io | ||
path: /var/www/html/staging |