removed platform name in image tag #5
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: Release | |
on: | |
push: | |
branches: | |
- argo-atlan | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
jobs: | |
build-linux-amd64: | |
name: Build & push linux/amd64 | |
if: github.repository == 'atlanhq/argo-workflows' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [ linux/amd64 ] | |
target: [ workflow-controller-atlan, argocli-atlan, argoexec-atlan ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: v0.10.4 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-${{ matrix.platform }}-${{ matrix.target }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.platform }}-${{ matrix.target }}-buildx- | |
- name: Login to GitHub Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: $GITHUB_ACTOR | |
password: ${{ secrets.my_pat }} | |
#- name: Docker Login | |
# uses: docker/login-action@v2 | |
# with: | |
# username: ${{ secrets.DOCKERIO_USERNAME }} | |
# password: ${{ secrets.DOCKERIO_PASSWORD }} | |
# copied from heracles repo | |
#- name: Build and push docker image | |
# id: docker_build | |
# uses: docker/[email protected] | |
# with: | |
# context: . | |
# file: ./Dockerfile | |
# push: true | |
# tags: | | |
# ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:latest | |
# #ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:${{ steps.get_version.outputs.version }} | |
# build-args: | | |
# ACCESS_TOKEN_USR=$GITHUB_ACTOR | |
# ACCESS_TOKEN_PWD=${{ secrets.my_pat }} | |
- name: Docker Buildx | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
TARGET: ${{ matrix.target }} | |
run: | | |
set -eux | |
tag=$(basename $GITHUB_REF) | |
if [ $tag = "argo-atlan" ]; then | |
tag="latest" | |
fi | |
# copied verbatim from Makefile | |
GIT_COMMIT=$(git rev-parse HEAD || echo unknown) | |
GIT_TAG=$(git describe --exact-match --tags --abbrev=0 2> /dev/null || echo untagged) | |
GIT_TREE_STATE=$(if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi) | |
tag_suffix=$(echo $PLATFORM | sed -r "s/\//-/g") | |
image_name="ghcr.io/atlanhq/${TARGET}:${tag} | |
docker buildx build \ | |
--cache-from "type=local,src=/tmp/.buildx-cache" \ | |
--cache-to "type=local,dest=/tmp/.buildx-cache" \ | |
--output "type=image,push=true" \ | |
--build-arg GIT_COMMIT=$GIT_COMMIT \ | |
--build-arg GIT_TAG=$GIT_TAG \ | |
--build-arg GIT_TREE_STATE=$GIT_TREE_STATE \ | |
--platform="${PLATFORM}" \ | |
--target $TARGET \ | |
--provenance=false \ | |
--tag $image_name . |