Skip to content

Trashcan timeout (#870) #226

Trashcan timeout (#870)

Trashcan timeout (#870) #226

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/[email protected]
with:
version: latest
install: true
- name: Extract Docker metadata for main build
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/ClemBotProject/ClemBot.Bot
flavor: |
latest=${{ github.event_name == 'push' }}
- name: Build and push Docker images
uses: docker/[email protected]
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/[email protected]"
with:
args: 'The project {{ EVENT_PAYLOAD.repository.full_name }}/ClemBot.Bot has been deployed.'