github.com/argoproj/argo-cd@v1.8.7/.github/workflows/image.yaml (about)

     1  name: Image
     2  
     3  on:
     4    push:
     5      branches:
     6        - master
     7  
     8  jobs:
     9    publish:
    10      runs-on: ubuntu-latest
    11      env:
    12        GOPATH: /home/runner/work/argo-cd/argo-cd
    13      steps:
    14        - uses: actions/setup-go@v1
    15          with:
    16            go-version: '1.14.12'
    17        - uses: actions/checkout@master
    18          with:
    19            path: src/github.com/argoproj/argo-cd
    20  
    21        # get image tag
    22        - run: echo ::set-output name=tag::$(cat ./VERSION)-${GITHUB_SHA::8}
    23          working-directory: ./src/github.com/argoproj/argo-cd
    24          id: image
    25  
    26        # build
    27        - run: |
    28            docker images -a --format "{{.ID}}" | xargs -I {} docker rmi {}
    29            make image DEV_IMAGE=true DOCKER_PUSH=false IMAGE_NAMESPACE=docker.pkg.github.com/argoproj/argo-cd IMAGE_TAG=${{ steps.image.outputs.tag }}
    30          working-directory: ./src/github.com/argoproj/argo-cd
    31  
    32        # publish
    33        - run: |
    34            docker login docker.pkg.github.com --username $USERNAME --password $PASSWORD
    35            docker push docker.pkg.github.com/argoproj/argo-cd/argocd:${{ steps.image.outputs.tag }}
    36          env:
    37            USERNAME: ${{ secrets.USERNAME }}
    38            PASSWORD: ${{ secrets.TOKEN }}
    39  
    40        # deploy
    41        - run: git clone "https://$TOKEN@github.com/argoproj/argoproj-deployments"
    42          env:
    43            TOKEN: ${{ secrets.TOKEN }}
    44        - run: |
    45            docker run -v $(pwd):/src -w /src --rm -t lyft/kustomizer:v3.3.0 kustomize edit set image argoproj/argocd=docker.pkg.github.com/argoproj/argo-cd/argocd:${{ steps.image.outputs.tag }}
    46            git config --global user.email 'ci@argoproj.com'
    47            git config --global user.name 'CI'
    48            git diff --exit-code && echo 'Already deployed' || (git commit -am 'Upgrade argocd to ${{ steps.image.outputs.tag }}' && git push)
    49          working-directory: argoproj-deployments/argocd
    50        # TODO: clean up old images once github supports it: https://github.community/t5/How-to-use-Git-and-GitHub/Deleting-images-from-Github-Package-Registry/m-p/41202/thread-id/9811