-
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.
ci: add workflow to deploy to server
- Loading branch information
1 parent
9c588c2
commit 55ead3e
Showing
1 changed file
with
59 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,59 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: 'Environment to deploy to' | ||
type: environment | ||
required: true | ||
|
||
jobs: | ||
deploy-staging: | ||
if: github.repository_owner == 'one-zero-eight' && ((github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging') || (github.event_name == 'push' && github.ref == 'refs/heads/main')) | ||
name: Deploy to staging server | ||
runs-on: self-hosted | ||
environment: | ||
name: staging | ||
url: https://t.me/innohassle_rooms_bot | ||
concurrency: | ||
group: staging | ||
cancel-in-progress: false | ||
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.DEPLOY_DIRECTORY }}" | ||
bash "${{ secrets.DEPLOY_SCRIPT }}" | ||
deploy-production: | ||
if: github.repository_owner == 'one-zero-eight' && (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production') | ||
name: Deploy to production server | ||
runs-on: self-hosted | ||
environment: | ||
name: production | ||
url: https://t.me/IURoomsBot | ||
concurrency: | ||
group: production | ||
cancel-in-progress: false | ||
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.DEPLOY_DIRECTORY }}" | ||
bash "${{ secrets.DEPLOY_SCRIPT }}" |