chore(event-reporter): refactoring, variables grouping, code splittin… #500
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: Image | |
on: | |
push: | |
branches: | |
- "release-*" # Codefresh change instead of `master` | |
env: | |
GOLANG_VERSION: "1.21" | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
env: | |
GOPATH: /home/runner/work/argo-cd/argo-cd | |
steps: | |
- uses: actions/setup-go@0caeaed6fd66a828038c2da3c0f662a42862658f # v1.1.3 | |
with: | |
go-version: ${{ env.GOLANG_VERSION }} | |
- uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master | |
with: | |
path: src/github.com/argoproj/argo-cd | |
# get image tag | |
- run: echo ::set-output name=tag::$(cat ./VERSION)-${GITHUB_SHA::8} | |
working-directory: ./src/github.com/argoproj/argo-cd | |
id: image | |
# build | |
- run: | | |
docker images -a --format "{{.ID}}" | xargs -I {} docker rmi {} | |
make image DEV_IMAGE=true DOCKER_PUSH=false IMAGE_NAMESPACE=ghcr.io/codefresh-io IMAGE_TAG=${{ steps.image.outputs.tag }} | |
working-directory: ./src/github.com/argoproj/argo-cd | |
- run: | | |
docker login ghcr.io --username $USERNAME --password $PASSWORD | |
docker push ghcr.io/codefresh-io/argocd:${{ steps.image.outputs.tag }} | |
env: | |
USERNAME: ${{ github.repository_owner }} | |
PASSWORD: ${{ secrets.TOKEN }} | |
# Codefresh step | |
- name: Push docker image to quay repository | |
env: | |
QUAY_USERNAME: ${{ secrets.RELEASE_QUAY_USERNAME }} | |
QUAY_TOKEN: ${{ secrets.RELEASE_QUAY_TOKEN }} | |
IMAGE_NAMESPACE: quay.io/codefresh | |
run: | | |
set -ue | |
docker login quay.io --username "${QUAY_USERNAME}" --password "${QUAY_TOKEN}" | |
docker tag ghcr.io/codefresh-io/argocd:${{ steps.image.outputs.tag }} ${IMAGE_NAMESPACE}/argocd:latest | |
docker push ${IMAGE_NAMESPACE}/argocd:latest | |
# deploy | |
- run: git clone "https://[email protected]/codefresh-io/argoproj-deployments" | |
env: | |
TOKEN: ${{ secrets.TOKEN }} | |
- run: | | |
docker run -v $(pwd):/src -w /src --rm -t lyft/kustomizer:v3.3.0 kustomize edit set image quay.io/argoproj/argocd=ghcr.io/codefresh-io/argocd:${{ steps.image.outputs.tag }} | |
git config --global user.email '[email protected]' | |
git config --global user.name 'CI-Codefresh' | |
git diff --exit-code && echo 'Already deployed' || (git commit -am 'Upgrade argocd to ${{ steps.image.outputs.tag }}' && git push) | |
if: github.event_name == 'push' | |
working-directory: argoproj-deployments/argocd |