mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-27 01:20:31 +03:00
55 lines
1.5 KiB
YAML
55 lines
1.5 KiB
YAML
name: GitHub Bot CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "release/*"
|
|
paths:
|
|
- "github-bot/**"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
docker-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Docker Hub login
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Version tag
|
|
run: 'echo "VERSION_TAG=$(cat package.json | grep version | head -1 | awk -F: ''{ print $2 }'' | sed ''s/[", ]//g'')" >> $GITHUB_ENV'
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Build and push
|
|
id: docker_build
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: ./
|
|
push: true
|
|
tags: ${{ secrets.DOCKER_USERNAME }}/tachi-gh-bot:stable,${{ secrets.DOCKER_USERNAME }}/tachi-gh-bot:${{ env.VERSION_TAG }}
|
|
file: ./Dockerfile.ghbot
|
|
cache-from: type=gha,scope=$GITHUB_REF_NAME-github-bot
|
|
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-github-bot
|
|
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: [docker-push]
|
|
steps:
|
|
- name: Deploy
|
|
uses: appleboy/ssh-action@1a8b3784eaa665f677fa114edd5683bb6a6bfaa8
|
|
with:
|
|
host: ${{ secrets.TACHI_HOST }}
|
|
username: tachi
|
|
key: ${{ secrets.TACHI_KEY }}
|
|
script: tachi-github-bot-deploy
|