mirror of
https://github.com/MetaCubeX/subconverter.git
synced 2025-11-04 18:19:42 +08:00
Fix Docker merge manifest
This commit is contained in:
parent
f8fab23da5
commit
356f4b07b2
213
.github/workflows/docker.yml
vendored
213
.github/workflows/docker.yml
vendored
@ -18,6 +18,12 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Get commit SHA
|
- name: Get commit SHA
|
||||||
id: vars
|
id: vars
|
||||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
@ -31,14 +37,7 @@ jobs:
|
|||||||
tags: tindy2013/subconverter:latest
|
tags: tindy2013/subconverter:latest
|
||||||
build-args: |
|
build-args: |
|
||||||
SHA=${{ steps.vars.outputs.sha_short }}
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
outputs: type=docker,dest=/tmp/image_amd64.tar
|
outputs: type=image,push=true
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: image_amd64
|
|
||||||
path: /tmp/image_amd64.tar
|
|
||||||
|
|
||||||
- name: Replace tag without `v`
|
- name: Replace tag without `v`
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@ -50,21 +49,28 @@ jobs:
|
|||||||
result-encoding: string
|
result-encoding: string
|
||||||
|
|
||||||
- name: Build release and export
|
- name: Build release and export
|
||||||
|
id: build_rel
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
context: scripts/
|
context: scripts/
|
||||||
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
outputs: type=docker,dest=/tmp/image_amd64_release.tar
|
outputs: type=image,push=true
|
||||||
|
|
||||||
|
- name: Save digest
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
|
||||||
|
|
||||||
- name: Upload release artifact
|
- name: Save release digest
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: image_amd64_release
|
name: digest_amd64
|
||||||
path: /tmp/image_amd64_release.tar
|
path: /tmp/digest.txt
|
||||||
|
|
||||||
x86_build:
|
x86_build:
|
||||||
name: Build x86 Image
|
name: Build x86 Image
|
||||||
@ -78,11 +84,18 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Get commit SHA
|
- name: Get commit SHA
|
||||||
id: vars
|
id: vars
|
||||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
- name: Build and export
|
- name: Build and export
|
||||||
|
id: build
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
@ -91,14 +104,7 @@ jobs:
|
|||||||
tags: tindy2013/subconverter:latest
|
tags: tindy2013/subconverter:latest
|
||||||
build-args: |
|
build-args: |
|
||||||
SHA=${{ steps.vars.outputs.sha_short }}
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
outputs: type=docker,dest=/tmp/image_386.tar
|
outputs: type=image,push=true
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: image_386
|
|
||||||
path: /tmp/image_386.tar
|
|
||||||
|
|
||||||
- name: Replace tag without `v`
|
- name: Replace tag without `v`
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@ -110,21 +116,28 @@ jobs:
|
|||||||
result-encoding: string
|
result-encoding: string
|
||||||
|
|
||||||
- name: Build release and export
|
- name: Build release and export
|
||||||
|
id: build_rel
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
platforms: linux/386
|
platforms: linux/386
|
||||||
context: scripts/
|
context: scripts/
|
||||||
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
outputs: type=docker,dest=/tmp/image_386_release.tar
|
outputs: type=image,push=true
|
||||||
|
|
||||||
|
- name: Save digest
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
|
||||||
|
|
||||||
- name: Upload release artifact
|
- name: Save release digest
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: image_386_release
|
name: digest_386
|
||||||
path: /tmp/image_386_release.tar
|
path: /tmp/digest.txt
|
||||||
|
|
||||||
armv7_build:
|
armv7_build:
|
||||||
name: Build ARMv7 Image
|
name: Build ARMv7 Image
|
||||||
@ -141,11 +154,18 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Get commit SHA
|
- name: Get commit SHA
|
||||||
id: vars
|
id: vars
|
||||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
- name: Build and export
|
- name: Build and export
|
||||||
|
id: build
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
@ -155,14 +175,7 @@ jobs:
|
|||||||
build-args: |
|
build-args: |
|
||||||
SHA=${{ steps.vars.outputs.sha_short }}
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
THREADS=2
|
THREADS=2
|
||||||
outputs: type=docker,dest=/tmp/image_armv7.tar
|
outputs: type=image,push=true
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: image_armv7
|
|
||||||
path: /tmp/image_armv7.tar
|
|
||||||
|
|
||||||
- name: Replace tag without `v`
|
- name: Replace tag without `v`
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@ -174,6 +187,7 @@ jobs:
|
|||||||
result-encoding: string
|
result-encoding: string
|
||||||
|
|
||||||
- name: Build release and export
|
- name: Build release and export
|
||||||
|
id: build_rel
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
@ -182,15 +196,21 @@ jobs:
|
|||||||
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
build-args: |
|
build-args: |
|
||||||
THREADS=2
|
THREADS=2
|
||||||
outputs: type=docker,dest=/tmp/image_armv7_release.tar
|
outputs: type=image,push=true
|
||||||
|
|
||||||
|
- name: Save digest
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
|
||||||
|
|
||||||
- name: Upload release artifact
|
- name: Save release digest
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: image_armv7_release
|
name: digest_armv7
|
||||||
path: /tmp/image_armv7_release.tar
|
path: /tmp/digest.txt
|
||||||
|
|
||||||
arm64_build:
|
arm64_build:
|
||||||
name: Build ARM64 Image
|
name: Build ARM64 Image
|
||||||
@ -207,11 +227,18 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Get commit SHA
|
- name: Get commit SHA
|
||||||
id: vars
|
id: vars
|
||||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
- name: Build and export
|
- name: Build and export
|
||||||
|
id: build
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
@ -221,14 +248,7 @@ jobs:
|
|||||||
build-args: |
|
build-args: |
|
||||||
SHA=${{ steps.vars.outputs.sha_short }}
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
THREADS=2
|
THREADS=2
|
||||||
outputs: type=docker,dest=/tmp/image_arm64.tar
|
outputs: type=image,push=true
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: image_arm64
|
|
||||||
path: /tmp/image_arm64.tar
|
|
||||||
|
|
||||||
- name: Replace tag without `v`
|
- name: Replace tag without `v`
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@ -240,6 +260,7 @@ jobs:
|
|||||||
result-encoding: string
|
result-encoding: string
|
||||||
|
|
||||||
- name: Build release and export
|
- name: Build release and export
|
||||||
|
id: build_rel
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
@ -248,15 +269,21 @@ jobs:
|
|||||||
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
build-args: |
|
build-args: |
|
||||||
THREADS=2
|
THREADS=2
|
||||||
outputs: type=docker,dest=/tmp/image_arm64_release.tar
|
outputs: type=image,push=true
|
||||||
|
|
||||||
|
- name: Save digest
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
|
||||||
|
|
||||||
- name: Upload release artifact
|
- name: Save release digest
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: image_arm64_release
|
name: digest_arm64
|
||||||
path: /tmp/image_arm64_release.tar
|
path: /tmp/digest.txt
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@ -283,16 +310,16 @@ jobs:
|
|||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp
|
path: /tmp/images/
|
||||||
|
|
||||||
- name: Load image
|
# - name: Load image
|
||||||
if: github.ref == 'refs/heads/master'
|
# if: github.ref == 'refs/heads/master'
|
||||||
run: |
|
# run: |
|
||||||
docker load --input /tmp/image_amd64/image_amd64.tar
|
# docker load --input /tmp/image_amd64/image_amd64.tar
|
||||||
docker load --input /tmp/image_386/image_386.tar
|
# docker load --input /tmp/image_386/image_386.tar
|
||||||
docker load --input /tmp/image_armv7/image_armv7.tar
|
# docker load --input /tmp/image_armv7/image_armv7.tar
|
||||||
docker load --input /tmp/image_arm64/image_arm64.tar
|
# docker load --input /tmp/image_arm64/image_arm64.tar
|
||||||
docker image ls -a
|
# docker image ls -a
|
||||||
|
|
||||||
- name: Docker login
|
- name: Docker login
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
@ -300,22 +327,22 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Get commit SHA
|
# - name: Get commit SHA
|
||||||
id: vars
|
# id: vars
|
||||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
# run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
- name: Docker buildx image and push on master branch
|
# - name: Docker buildx image and push on master branch
|
||||||
if: github.ref == 'refs/heads/master'
|
# if: github.ref == 'refs/heads/master'
|
||||||
uses: docker/build-push-action@v3
|
# uses: docker/build-push-action@v3
|
||||||
with:
|
# with:
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
|
# platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
|
||||||
context: scripts/
|
# context: scripts/
|
||||||
tags: tindy2013/subconverter:latest
|
# tags: tindy2013/subconverter:latest
|
||||||
build-args: |
|
# build-args: |
|
||||||
SHA=${{ steps.vars.outputs.sha_short }}
|
# SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
THREADS=1
|
# THREADS=1
|
||||||
outputs: |
|
# outputs: |
|
||||||
type=image,push=true
|
# type=image,push=true
|
||||||
|
|
||||||
- name: Replace tag without `v`
|
- name: Replace tag without `v`
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@ -326,23 +353,29 @@ jobs:
|
|||||||
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
|
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
|
|
||||||
- name: Load release image
|
# - name: Load release image
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
# if: startsWith(github.ref, 'refs/tags/')
|
||||||
run: |
|
# run: |
|
||||||
docker load --input /tmp/image_amd64/image_amd64_release.tar
|
# docker load --input /tmp/image_amd64/image_amd64_release.tar
|
||||||
docker load --input /tmp/image_386/image_386_release.tar
|
# docker load --input /tmp/image_386/image_386_release.tar
|
||||||
docker load --input /tmp/image_armv7/image_armv7_release.tar
|
# docker load --input /tmp/image_armv7/image_armv7_release.tar
|
||||||
docker load --input /tmp/image_arm64/image_arm64_release.tar
|
# docker load --input /tmp/image_arm64/image_arm64_release.tar
|
||||||
docker image ls -a
|
# docker image ls -a
|
||||||
|
|
||||||
- name: Docker buildx image and push on release
|
# - name: Docker buildx image and push on release
|
||||||
|
# if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
# uses: docker/build-push-action@v3
|
||||||
|
# with:
|
||||||
|
# platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
|
||||||
|
# context: scripts/
|
||||||
|
# tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
|
# build-args: THREADS=1
|
||||||
|
# outputs: type=image,push=true
|
||||||
|
|
||||||
|
- name: Merge and push manifest on master branch
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: python scripts/merge_manifest.py
|
||||||
|
|
||||||
|
- name: Merge and push manifest on release
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: docker/build-push-action@v3
|
run: python scripts/merge_manifest.py ${{steps.version.outputs.result}}
|
||||||
with:
|
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
|
|
||||||
context: scripts/
|
|
||||||
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
|
||||||
build-args: |
|
|
||||||
THREADS=1
|
|
||||||
outputs: |
|
|
||||||
type=image,push=true
|
|
||||||
|
|||||||
14
scripts/merge_manifest.py
Normal file
14
scripts/merge_manifest.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import glob
|
||||||
|
import os, sys
|
||||||
|
|
||||||
|
MAIN_IMAGE_NAME="tindy2013/subconverter"
|
||||||
|
TARGET_TAG="latest" if len(sys.argv) < 2 else sys.argv[1]
|
||||||
|
|
||||||
|
args=["docker manifest create {}:{}".format(MAIN_IMAGE_NAME, TARGET_TAG)]
|
||||||
|
for i in glob.glob("/tmp/images/*/*.txt"):
|
||||||
|
with open(i, "r") as file:
|
||||||
|
args += " --amend {}@{}".format(MAIN_IMAGE_NAME, file.readline())
|
||||||
|
cmd_create="".join(args)
|
||||||
|
cmd_push="docker manifest push {}:{}".format(MAIN_IMAGE_NAME, TARGET_TAG)
|
||||||
|
os.system(cmd_create)
|
||||||
|
os.system(cmd_push)
|
||||||
Loading…
Reference in New Issue
Block a user