diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 67b9dc5..9ee31fa 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -2,7 +2,7 @@ name: CI and CD on: push: - branches: [main] + branches: [ main ] pull_request: jobs: @@ -61,16 +61,16 @@ jobs: - name: Setup SHA run: echo "GITHUB_SHA=${GITHUB_SHA}" >> $GITHUB_ENV - + - name: Integration test inside Docker-compose cleanup run: docker-compose -f docker-compose.test.yml down - + - name: Integration test inside Docker-compose run: docker-compose -f docker-compose.test.yml up --build --abort-on-container-exit --exit-code-from it_test - name: Build the Docker image run: docker build . --file Dockerfile --tag ghcr.io/aorjoa/devops-java-example:${{ env.GITHUB_SHA }} - + - name: Login ghcr.io uses: docker/login-action@v1.8.0 with: @@ -78,7 +78,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.PAT }} logout: true - + - name: Push to GitHub Container Registry uses: docker/build-push-action@v2 with: @@ -93,27 +93,27 @@ jobs: # ============== # CD task # ============== - # gitops-versioning: - # runs-on: ubuntu-latest - # needs: build-and-push-docker-image - # steps: - # - name: checkout - # uses: actions/checkout@v4 - # with: - # repository: aorjoa/devops-argocd - # persist-credentials: false - # fetch-depth: 0 - # - name: change image tag - # run: | - # git --version - # git config user.name "aorjoa" - # git config user.email "root@aorjoa.link" - # sed -i -E "s/ghcr.io\/aorjoa-training\/devops-go-example.*$/ghcr.io\/aorjoa-training\/devops-go-example:${GITHUB_SHA}/" kube-gitops/deployment.yml - # git add kube-gitops/deployment.yml - # git commit -m "🤖 change docker image version to ${GITHUB_SHA}" - # - name: push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.PAT }} - # repository: aorjoa-training/devops-argocd - # branch: main \ No newline at end of file + gitops-versioning: + runs-on: ubuntu-latest + needs: build-and-push-docker-image + steps: + - name: checkout + uses: actions/checkout@v4 + with: + repository: aorjoa/devops-argocd + persist-credentials: false + fetch-depth: 0 + - name: change image tag + run: | + git --version + git config user.name "aorjoa" + git config user.email "root@aorjoa.link" + sed -i -E "s/ghcr.io\/aorjoa\/devops-java-example.*$/ghcr.io\/aorjoa\/devops-java-example:${GITHUB_SHA}/" kube-gitops/deployment.yml + git add kube-gitops/deployment.yml + git commit -m "🤖 change docker image version to ${GITHUB_SHA}" + - name: push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.PAT }} + repository: aorjoa/devops-argocd + branch: main \ No newline at end of file