This commit is contained in:
omg-xtao 2024-11-01 06:21:32 +00:00 committed by GitHub
parent 13e606c76b
commit 9c25d4656e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,28 +1,19 @@
name: Docker multi-arch build and push name: Docker multi-arch build and push
on: on:
push: workflow_dispatch: ~
branches:
- master
schedule:
- cron: '20 4 * * *'
jobs: jobs:
build: build:
name: Build Docker image (${{ matrix.arch }}) name: Build Docker image (${{ matrix.arch }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
IMAGE_TAG: ${{ secrets.DOCKERHUB_OWNER }}/telegram-bot-api IMAGE_TAG: ${{ secrets.DOCKER_USERNAME }}/telegram-bot-api
ALPINE_VERSION: '3.20' ALPINE_VERSION: '3.20'
strategy: strategy:
matrix: matrix:
arch: arch:
- linux/386
- linux/amd64 - linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/ppc64le
steps: steps:
- name: Checkout current repo - name: Checkout current repo
@ -31,7 +22,7 @@ jobs:
- name: Checkout upstream repo - name: Checkout upstream repo
uses: actions/checkout@v4.1.6 uses: actions/checkout@v4.1.6
with: with:
repository: tdlib/telegram-bot-api repository: paigramteam/telegram-bot-api
path: telegram-bot-api path: telegram-bot-api
submodules: recursive submodules: recursive
@ -86,8 +77,8 @@ jobs:
uses: docker/login-action@v3.2.0 uses: docker/login-action@v3.2.0
if: ${{ github.event_name != 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
with: with:
username: ${{ secrets.DOCKERHUB_LOGIN }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKER_TOKEN }}
- name: Build image - name: Build image
uses: docker/build-push-action@v5.3.0 uses: docker/build-push-action@v5.3.0
@ -135,42 +126,20 @@ jobs:
- name: Load environment info and built images - name: Load environment info and built images
run: | run: |
cat github_env/github.env > $GITHUB_ENV cat github_env/github.env > $GITHUB_ENV
docker load --input image_linux386/linux386.tar
docker load --input image_linuxamd64/linuxamd64.tar docker load --input image_linuxamd64/linuxamd64.tar
docker load --input image_linuxarmv6/linuxarmv6.tar
docker load --input image_linuxarmv7/linuxarmv7.tar
docker load --input image_linuxarm64/linuxarm64.tar
docker load --input image_linuxppc64le/linuxppc64le.tar
- name: Login to ghcr registry
uses: docker/login-action@v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub registry - name: Login to Docker Hub registry
uses: docker/login-action@v3.2.0 uses: docker/login-action@v3.2.0
with: with:
username: ${{ secrets.DOCKERHUB_LOGIN }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKER_TOKEN }}
- name: Create and push manifest - name: Create and push manifest
run: | run: |
docker manifest create ${{ env.IMAGE_TAG }}:${{ env.VERSION }} \ docker manifest create ${{ env.IMAGE_TAG }}:${{ env.VERSION }} \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linux386 \ --amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxamd64
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxamd64 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarmv6 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarmv7 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarm64 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxppc64le
docker manifest push ${{ env.IMAGE_TAG }}:${{ env.VERSION }} docker manifest push ${{ env.IMAGE_TAG }}:${{ env.VERSION }}
docker manifest create ${{ env.IMAGE_TAG }}:latest \ docker manifest create ${{ env.IMAGE_TAG }}:latest \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linux386 \ --amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxamd64
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxamd64 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarmv6 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarmv7 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarm64 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxppc64le
docker manifest push ${{ env.IMAGE_TAG }}:latest docker manifest push ${{ env.IMAGE_TAG }}:latest