-
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.
- Loading branch information
Showing
3 changed files
with
60 additions
and
3 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,55 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- add-deploy-workflow # FIXME: remove this line | ||
workflow_dispatch: # This will make the workflow dispatched only manually | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Compose | ||
uses: ndeloof/[email protected] | ||
with: | ||
version: v2.20.2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build docker images | ||
run: docker compose build | ||
|
||
- name: Push docker images | ||
run: docker compose push | ||
|
||
deploy: | ||
needs: build-and-push | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Compose | ||
uses: ndeloof/[email protected] | ||
with: | ||
version: v2.20.2 | ||
|
||
- name: Deploy to the VM | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ vars.VM_HOST }} | ||
username: ${{ vars.VM_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
script: | | ||
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | ||
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
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