1
0
mirror of https://github.com/umputun/reproxy.git synced 2024-11-24 08:12:31 +02:00

multi tag build

This commit is contained in:
Umputun 2021-04-11 16:46:59 -05:00
parent c01b79f296
commit b130f039d8

View File

@ -55,8 +55,8 @@ jobs:
- name: available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: build and deploy image to ghcr.io and dockerhub
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
- name: build and deploy master image to ghcr.io and dockerhub
if: ${{ github.ref == 'refs/heads/master' ) }}
env:
GITHUB_PACKAGE_TOKEN: ${{ secrets.PKG_TOKEN }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
@ -67,23 +67,27 @@ jobs:
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo GITHUB_REF - $ref
echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin
echo ${DOCKER_HUB_TOKEN} | docker login -u ${USERNAME} --password-stdin
docker buildx build --push \
--build-arg CI=github --build-arg GITHUB_SHA=${GITHUB_SHA} --build-arg GIT_BRANCH=${ref} \
--platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 \
-t ghcr.io/${USERNAME}/reproxy:${ref} .
docker pull ghcr.io/${USERNAME}/reproxy:${ref}
echo ${DOCKER_HUB_TOKEN} | docker login -u ${USERNAME} --password-stdin
docker tag ghcr.io/${USERNAME}/reproxy:${ref} ${USERNAME}/reproxy:${ref}
docker push ${USERNAME}/reproxy:${ref}
-t ghcr.io/${USERNAME}/reproxy:${ref} -t ${USERNAME}/reproxy:${ref} .
- name: deploy tagged (latest) to ghcr.io and dockerhub
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_PACKAGE_TOKEN: ${{ secrets.PKG_TOKEN }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
USERNAME: ${{ github.actor }}
GITHUB_SHA: ${{ github.sha}}
GITHUB_REF: ${{ github.ref}}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo GITHUB_REF - $ref
docker tag ghcr.io/${USERNAME}/reproxy:${ref} ghcr.io/${USERNAME}/reproxy:latest
docker tag ghcr.io/${USERNAME}/reproxy:${ref} ${USERNAME}/reproxy:latest
docker push ghcr.io/${USERNAME}/reproxy:latest
docker push ${USERNAME}/reproxy:latest
echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin
echo ${DOCKER_HUB_TOKEN} | docker login -u ${USERNAME} --password-stdin
docker buildx build --push \
--build-arg CI=github --build-arg GITHUB_SHA=${GITHUB_SHA} --build-arg GIT_BRANCH=${ref} \
--platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 \
-t ghcr.io/${USERNAME}/reproxy:${ref} -t ghcr.io/${USERNAME}/reproxy:latest \
-t ${USERNAME}/reproxy:${ref} ${USERNAME}/reproxy:latest .