Adds argocd installation #2
This file contains hidden or 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: cicd | |
| on: | |
| push: | |
| paths: | |
| - src/** | |
| brances: | |
| - main | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: Shorten commit id | |
| shell: bash | |
| run: | | |
| echo "COMMIT_ID=${GITHUB_SHA::6}" >> "$GITHUB_ENV" | |
| - | |
| name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| tags: tyrelfecha/python-app:${{ env.COMMIT_ID }} | |
| cd: | |
| needs: ci | |
| runs-on: self-hosted | |
| steps: | |
| - | |
| name: Install argocd | |
| shell: bash | |
| run: | | |
| curl -ksSL -o argocd-linux-amd64 https://argocd-server.argocd/download/argocd-linux-amd64 | |
| chmod +x argocd | |
| sudo mv argocd /usr/local/bin/argocd | |
| - | |
| name: Argocd app sync | |
| shell: bash | |
| run: | | |
| argocd login argocd-server.argocd \ | |
| --insecure \ | |
| --grpc-web \ | |
| --username admin \ | |
| --password ${{ secrets.ARGOCD_PASSWORD }} | |
| argocd app sync python-app |