Skip to content

add help to slash commands #32

add help to slash commands

add help to slash commands #32

name: "[MAIN] Docker Image Build and Publish"
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: ["main"]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
ghcr:
name: Deploy to GitHub Container Registry
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected]
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Login to GitHub Container Registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: downcase REPO
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Build and Push Docker Image
run: |
export CURRENT_BRANCH=${GITHUB_REF#refs/heads/}
export TAG=$([[ $CURRENT_BRANCH == "main" ]] && echo $CURRENT_BRANCH || echo "latest")
export GITHUB_REF_IMAGE=ghcr.io/myriadflow/airbot:$GITHUB_SHA
export GITHUB_BRANCH_IMAGE=ghcr.io/myriadflow/airbot:$TAG
docker build -t $GITHUB_REF_IMAGE -t $GITHUB_BRANCH_IMAGE .
echo "Pushing Image to GitHub Container Registry"
docker push $GITHUB_REF_IMAGE
docker push $GITHUB_BRANCH_IMAGE
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: lazarusnetwork/airbot:latest
- name: Deploy on Dev Server
if: github.ref == 'refs/heads/main'
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEV_REMOTE_SERVER_ADDRESS }}
username: ${{ secrets.DEV_SERVER_USERNAME }}
key: ${{ secrets.DEV_REMOTE_SERVER_KEY }}
port: ${{ secrets.DEV_SSH_PORT }}
script: |
pwd
cd airbot
sudo podman stop airbot && sudo podman rm airbot && sudo podman image rm airbot
echo ${{ secrets.GHCR_TOKEN }} | podman login ghcr.io -u secrets.GHCR_USERNAME --password-stdin
sudo podman pull ghcr.io/myriadflow/airbot:main
sudo podman run --name="airbot" --env-file=.env --net=bridge -d ghcr.io/myriadflow/airbot:main