Skip to content

Commit

Permalink
modify
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao authored Feb 22, 2024
1 parent 7b1f1d3 commit 57cfcc4
Showing 1 changed file with 9 additions and 36 deletions.
45 changes: 9 additions & 36 deletions .github/workflows/multiarch.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
name: Docker multi-arch build and push

on:
push:
branches:
- master
schedule:
- cron: '20 4 * * *'
workflow_dispatch: ~

jobs:
build:
name: Build Docker image (${{ matrix.arch }})
runs-on: ubuntu-latest
env:
IMAGE_TAG: ${{ secrets.DOCKERHUB_OWNER }}/telegram-bot-api
IMAGE_TAG: ${{ secrets.DOCKER_USERNAME }}/telegram-bot-api
ALPINE_VERSION: 3.19
strategy:
matrix:
arch:
- linux/386
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/ppc64le

steps:
- name: Checkout current repo
Expand All @@ -31,7 +23,7 @@ jobs:
- name: Checkout upstream repo
uses: actions/checkout@v4
with:
repository: tdlib/telegram-bot-api
repository: paigramteam/telegram-bot-api
path: telegram-bot-api
submodules: recursive

Expand Down Expand Up @@ -85,8 +77,8 @@ jobs:
uses: docker/login-action@v2
if: ${{ github.event_name != 'pull_request' }}
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build image
uses: docker/build-push-action@v2
Expand Down Expand Up @@ -136,40 +128,21 @@ jobs:
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_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@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Create and push manifest
run: |
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 }}-linuxarmv6 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarmv7 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarm64 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxppc64le
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxamd64
docker manifest push ${{ env.IMAGE_TAG }}:${{ env.VERSION }}
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 }}-linuxarmv6 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarmv7 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxarm64 \
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxppc64le
--amend ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-linuxamd64
docker manifest push ${{ env.IMAGE_TAG }}:latest

0 comments on commit 57cfcc4

Please sign in to comment.