Skip to content

ci: update node and docker #17

ci: update node and docker

ci: update node and docker #17

Workflow file for this run

name: deploy
on:
workflow_dispatch:
push:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE.md'
branches:
- main
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up dockertags
run: |
echo "dockertags=digisquad/cssninja.fresh-demo:latest" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
timeout-minutes: 60
with:
push: true
tags: ${{ env.dockertags }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
runs-on: ubuntu-latest
needs: [docker-build]
steps:
- uses: actions/checkout@v4
- name: Prepare
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script_stop: true
script: mkdir -p ${{ secrets.HOST_DIRECTORY }}
- name: Publish
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: docker-compose.yml
target: ${{ secrets.HOST_DIRECTORY }}
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script_stop: true
script: |
cd ${{ secrets.HOST_DIRECTORY }}
docker compose pull
docker compose up -d --force-recreate --remove-orphans