Skip to content

Commit

Permalink
added deploy pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
NivEz committed Aug 6, 2023
1 parent 2c3f6c8 commit aed2784
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and push
name: Build and deploy

on:
push:
Expand All @@ -9,6 +9,7 @@ env:

jobs:
build:
# if: "false"
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -24,6 +25,9 @@ jobs:
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2

- name: Build Docker images
run: docker compose build
Expand All @@ -44,4 +48,36 @@ jobs:
- name: Push Docker images
run: |
docker push $DOCKER_REPO_CLIENT --all-tags
docker push $DOCKER_REPO_SERVER --all-tags
docker push $DOCKER_REPO_SERVER --all-tags
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Twingate
uses: twingate/github-action@v1
with:
# note that the service key is valid for 365 days
service-key: ${{ secrets.TWINGATE_SERVICE_KEY }}

- name: SCP file
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "docker-compose.yaml"
target: "~/super-bulb/"

- name: SSH command - docker-compose up
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd super-bulb
docker compose up -d
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ services:
build:
context: ./client
dockerfile: Dockerfile
platforms:
- linux/arm64
- linux/amd64
image: nivezra/super-bulb-client:latest
container_name: super-bulb-client
restart: unless-stopped
Expand All @@ -13,6 +16,9 @@ services:
build:
context: ./server
dockerfile: Dockerfile
platforms:
- linux/arm64
- linux/amd64
image: nivezra/super-bulb-server:latest
container_name: super-bulb-server
restart: unless-stopped
Expand Down

0 comments on commit aed2784

Please sign in to comment.