Build and Deploy on Production #8
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
name: Build and Deploy on Production | |
on: | |
workflow_run: | |
workflows: [ Run unit tests ] | |
branches: [ master ] | |
types: | |
- completed | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ^1.21 | |
id: go | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Create empty env file | |
run: touch app.env | |
- name: Build | |
run: make build | |
- name: Deploy to Server | |
uses: burnett01/[email protected] | |
with: | |
switches: -avzr --delete --include="main" --include="db" --include="db/migration" --exclude="db/*" --exclude="*" | |
path: . | |
remote_path: /home/arman | |
remote_host: ${{ secrets.HOST }} | |
remote_port: ${{ secrets.PORT }} | |
remote_user: ${{ secrets.USERNAME }} | |
remote_key: ${{ secrets.SSH_PRIVATE_KEY }} |