2020-11-06 22:55:20 +00:00
|
|
|
name: Docker Image
|
|
|
|
|
2020-11-12 20:02:13 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-11-12 20:36:49 +00:00
|
|
|
schedule:
|
|
|
|
- cron: '20 4 * * *'
|
2020-11-06 22:55:20 +00:00
|
|
|
|
|
|
|
jobs:
|
2020-11-12 20:36:49 +00:00
|
|
|
build:
|
2020-11-06 22:55:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-10-03 14:34:53 +00:00
|
|
|
- &checkout
|
|
|
|
name: Checkout
|
2020-11-06 22:55:20 +00:00
|
|
|
uses: actions/checkout@v2
|
2021-10-03 14:34:53 +00:00
|
|
|
- &checkout-upstream
|
|
|
|
name: Checkout upstream repo
|
2020-11-12 20:22:49 +00:00
|
|
|
uses: actions/checkout@v2
|
2020-11-06 22:55:20 +00:00
|
|
|
with:
|
2020-11-12 20:22:49 +00:00
|
|
|
repository: tdlib/telegram-bot-api
|
|
|
|
path: telegram-bot-api
|
|
|
|
submodules: recursive
|
2021-08-03 12:34:18 +00:00
|
|
|
- name: Cache Docker layers
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
2021-10-03 14:34:53 +00:00
|
|
|
- &setup-qemu
|
|
|
|
name: Set up QEMU
|
2020-11-06 22:55:20 +00:00
|
|
|
uses: docker/setup-qemu-action@v1
|
2021-10-03 14:34:53 +00:00
|
|
|
- &setup-buildx
|
|
|
|
name: Set up Docker Buildx
|
2020-11-06 22:55:20 +00:00
|
|
|
uses: docker/setup-buildx-action@v1
|
2021-10-03 14:34:53 +00:00
|
|
|
- &login-dockerhub
|
|
|
|
name: Login to DockerHub
|
2020-11-12 20:36:49 +00:00
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_LOGIN }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2021-10-03 14:34:53 +00:00
|
|
|
- &set-version
|
|
|
|
name: Set version
|
2020-11-29 23:36:40 +00:00
|
|
|
id: current-version
|
2020-11-29 23:20:03 +00:00
|
|
|
run: |
|
2020-11-29 23:30:39 +00:00
|
|
|
TG_SERVER_VERSION=$(cat telegram-bot-api/CMakeLists.txt | grep TelegramBotApi | cut -d " " -f3)
|
2020-11-29 23:36:40 +00:00
|
|
|
echo "TG_SERVER_VERSION=${TG_SERVER_VERSION}" >> $GITHUB_ENV
|
2020-11-29 23:20:03 +00:00
|
|
|
echo "Parsed version: ${TG_SERVER_VERSION}"
|
2020-11-06 22:55:20 +00:00
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v2
|
2021-10-03 14:34:53 +00:00
|
|
|
with: &build-and-push-with
|
2020-11-06 22:55:20 +00:00
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
2021-10-03 14:34:53 +00:00
|
|
|
platforms: linux/386,linux/amd64
|
2020-11-12 20:36:49 +00:00
|
|
|
push: true
|
2021-08-03 12:34:18 +00:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
2020-11-06 22:55:20 +00:00
|
|
|
tags: |
|
|
|
|
aiogram/telegram-bot-api:latest
|
2020-11-29 23:40:32 +00:00
|
|
|
aiogram/telegram-bot-api:${{ env.TG_SERVER_VERSION }}
|
2021-10-03 14:34:53 +00:00
|
|
|
|
|
|
|
build-arm:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- *checkout
|
|
|
|
- *checkout-upstream
|
|
|
|
- name: Cache Docker layers
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-arm-${{ github.sha }}
|
|
|
|
- *setup-qemu
|
|
|
|
- *setup-buildx
|
|
|
|
- *login-dockerhub
|
|
|
|
- *set-version
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
<<: *build-and-push-with
|
|
|
|
platforms: linux/arm/v7,linux/arm64
|
|
|
|
tags: |
|
|
|
|
aiogram/telegram-bot-api:arm-${{ env.TG_SERVER_VERSION }}
|