diff --git a/.github/workflows/build.yaml b/.github/workflows/build-and-deploy.yaml similarity index 51% rename from .github/workflows/build.yaml rename to .github/workflows/build-and-deploy.yaml index 7c7d991..a65a397 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build-and-deploy.yaml @@ -1,4 +1,4 @@ -name: Build and push +name: Build and deploy on: push: @@ -9,6 +9,7 @@ env: jobs: build: + # if: "false" runs-on: ubuntu-latest permissions: contents: write @@ -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 @@ -44,4 +48,36 @@ jobs: - name: Push Docker images run: | docker push $DOCKER_REPO_CLIENT --all-tags - docker push $DOCKER_REPO_SERVER --all-tags \ No newline at end of file + 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 diff --git a/docker-compose.yaml b/docker-compose.yaml index 97e5179..15943ab 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,6 +4,7 @@ services: context: ./client dockerfile: Dockerfile image: nivezra/super-bulb-client:latest + platform: linux/arm64/v8 container_name: super-bulb-client restart: unless-stopped ports: @@ -14,6 +15,7 @@ services: context: ./server dockerfile: Dockerfile image: nivezra/super-bulb-server:latest + platform: linux/arm64/v8 container_name: super-bulb-server restart: unless-stopped ports: