Skip to content

onde-onebot

onde-onebot #40

Workflow file for this run

name: onde-onebot
on:
workflow_dispatch:
schedule:
- cron: '0 16 * * 6'
jobs:
build:
strategy:
matrix:
plugin: [onebots,onebots-ffmpeg]
runs-on: ubuntu-latest
steps:
- name: Check Out
uses: actions/checkout@v3
- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai
- name: ready
run: |
dirname=${{ matrix.plugin }}
ffmpeg=false
if [[ "$dirname" == *"-ffmpeg" ]] ; then
dirname=${dirname%-ffmpeg}
ffmpeg=true
fi
cp -r ./node-onebot/$dirname/* ./
if [ "$ffmpeg" = "true" ] ; then
mv Dockerfile-ffmpeg Dockerfile
fi
chmod +x docker-entrypoint.sh
# docker login
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# 设置 docker buildx 环境
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# build 前置操作
- name: Docker before
id: docker_before
run: |
image="${{ secrets.DOCKER_HUB_USERNAME }}/node-onebot"
tags="$image:${{matrix.plugin}}_$(date +'%m-%d_%H-%M-%S'),$image:${{matrix.plugin}}"
if [ "${{matrix.plugin}}" = "onebots" ] ; then
tags="$tags,$image:latest"
fi
echo "target images $tags"
echo "tags=$tags" >> $GITHUB_OUTPUT
# 一个特殊镜像,修复某些buildx 的 bug
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes > /dev/null 2>&1
# build 并且 push docker 镜像
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{steps.docker_before.outputs.tags}}
platforms: linux/amd64,linux/arm64/v8
# 打印 docker 镜像 SHA256 Hash 值
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}