44 lines
1.4 KiB
YAML

name: Build And Push Image On Harbor And Update
on:
push:
branches: [ "develop" ]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v1
with:
registry: registry.tips-of-mine.com
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
- uses: actions/checkout@v3
- name: BuildAndPushImageOnHarbor
run: |
docker build ./ -t registry.tips-of-mine.com/chaturmail/chaturmail-backend:${{ github.run_number }}
docker push registry.tips-of-mine.com/chaturmail/chaturmail-backend:${{ github.run_number }}
- name: Clone Repository
run: |
git clone <argocd-config-repo-url>
- name: Install yq
run: |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod a+x /usr/local/bin/yq
- name: Update YAML File
run: |
yq -i '.spec.template.spec.containers[0].image = "registry.tips-of-mine.com/chaturmail/chaturmail-backend:${{ github.run_number }}"' 'argocd-configs/chaturmail-pod.yaml'
- name: Push to Repo
run: |
git config --global user.name "${{secrets.USERNAME_GITHUB}}"
git config --global user.email "${{secrets.EMAIL_GITHUB}}"
cd argocd-test-configs
git add .
git commit -m "Updated by GitHub Actions"
git push <argocd-config-repo-url> --all