push it!! #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push image | |
on: | |
push: | |
branches: | |
- master | |
- release-image | |
pull_request: | |
branches: | |
- master | |
types: [ labeled, unlabeled, opened, synchronize, reopened ] | |
jobs: | |
build_image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
path: argocd-image-updater | |
- name: Setup qemu | |
uses: docker/setup-qemu-action@v1 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and possibly push image | |
run: | | |
set -ex | |
MULTIARCH=no | |
PUSH=no | |
if [[ "${{ github.event_name }}" == "push" ]]; then | |
# MULTIARCH=yes | |
PUSH=yes | |
elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'test-arm-image') }}" == "true" ]]; then | |
MULTIARCH=yes | |
fi | |
if [[ "${PUSH}" == "yes" ]]; then | |
docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" | |
fi | |
if [[ "${MULTIARCH}" = "yes" ]]; then | |
IMAGE_PUSH=${PUSH} make multiarch-image | |
else | |
make image image-push | |
fi | |
working-directory: argocd-image-updater | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }} |