Skip to content

Workflow file for this run

name:
on:
push:
branches:
- 'main'
release:
types: [published]
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build and Push to Docker Hub
uses: docker/build-push-action@v5
id: docker_build_client
with:
context: .
file: ./Dockerfile
builder: ${{steps.buildx.outputs.name}}
push: true
tags: dialoguebot/chatbox:latest
deploy:
runs-on: ubuntu-latest
needs: build-push
steps:
- name: Executing remote ssh commands using ssh key
uses: fifsky/ssh-action@master
with:
command: |
cd /home/ubuntu
sudo docker rmi $(sudo docker images --filter "dangling=true" -q --no-trunc)
sudo docker-compose pull
sudo docker-compose up -d
host: ${{ secrets.HOST }}
user: ${{ secrets.USERNAME }}
pass: ${{ secrets.PASSWORD }}
publish-package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Authenticate to npm registry
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Install Dependencies
run: npm install
- name: Publish Package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}