Skip to content

#855: Ban users without requiring them to be in the server (#862) #222

#855: Ban users without requiring them to be in the server (#862)

#855: Ban users without requiring them to be in the server (#862) #222

name: ClemBot.Bot-deployment
on:
push:
branches: [ master ]
paths:
- "ClemBot.Bot/**"
workflow_dispatch:
inputs:
name:
description: 'Manual ClemBot.Bot workflow trigger'
required: true
default: 'Manual Deployment'
permissions:
packages: write
env:
REGISTRY: ghcr.io
jobs:
build-push-clembot-bot:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1.5.1
with:
version: latest
install: true
- name: Extract Docker metadata for main build
id: meta
uses: docker/metadata-action@v3.4.1
with:
images: ${{ env.REGISTRY }}/ClemBotProject/ClemBot.Bot
flavor: |
latest=${{ github.event_name == 'push' }}
- name: Build and push Docker images
uses: docker/build-push-action@v2.6.1
with:
context: ./ClemBot.Bot
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-to: type=gha, scope=${{github.repository}}
cache-from: type=gha, scope=${{github.repository}}
deploy-clembot-bot:
runs-on: [self-hosted]
needs: ['build-push-clembot-bot']
steps:
- uses: actions/checkout@v2
- name: Copy Secrets
run: |
cp ~/ClemBot.Api_env.env ./ClemBot.Api/ClemBot.Api_env.env
cp ~/ClemBot.Bot_env.env ./ClemBot.Bot/ClemBot.Bot_env.env
cp ~/ClemBot.Site_env.env ./ClemBot.Site/ClemBot.Site_env.env
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy updated images
run: |
docker-compose pull clembot.bot
docker-compose up -d clembot.bot
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK_URL }}
uses: "Ilshidur/action-discord@0.3.0"
with:
args: 'The project {{ EVENT_PAYLOAD.repository.full_name }}/ClemBot.Bot has been deployed.'