-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploy: setup auto deploy to staging and production servers
- Loading branch information
1 parent
b0df811
commit 45b7ebe
Showing
2 changed files
with
67 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,32 @@ | ||
name: Deploy to production server | ||
|
||
concurrency: | ||
group: production | ||
cancel-in-progress: false | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy to production server | ||
runs-on: self-hosted | ||
environment: | ||
name: production | ||
steps: | ||
- name: Deploy via SSH | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_KEY }} | ||
fingerprint: ${{ secrets.SSH_FINGERPRINT }} | ||
script_stop: true # Stop script on error | ||
script: | | ||
cd ${{ secrets.REPOSITORY_ROOT }} | ||
git reset --hard | ||
git checkout ${{ github.ref_name }} | ||
git pull | ||
docker compose build | ||
docker compose pull | ||
docker compose up -d |
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,35 @@ | ||
name: Deploy to staging server | ||
|
||
concurrency: | ||
group: staging | ||
cancel-in-progress: false | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy to staging server | ||
runs-on: self-hosted | ||
environment: | ||
name: staging | ||
steps: | ||
- name: Deploy via SSH | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_KEY }} | ||
fingerprint: ${{ secrets.SSH_FINGERPRINT }} | ||
script_stop: true # Stop script on error | ||
script: | | ||
cd ${{ secrets.REPOSITORY_ROOT }} | ||
git reset --hard | ||
git checkout ${{ github.ref_name }} | ||
git pull | ||
docker compose build | ||
docker compose pull | ||
docker compose up -d |