diff --git a/.github/workflows/docker-build-push-api.yml b/.github/workflows/docker-build-push-api.yml index d3b7f86..8888556 100644 --- a/.github/workflows/docker-build-push-api.yml +++ b/.github/workflows/docker-build-push-api.yml @@ -7,35 +7,22 @@ on: paths: - cmd/api/main.go - .github/workflows/docker-build-push-api.yml - delete: permissions: contents: write jobs: build-and-push: - if: github.event_name == 'push' uses: ./.github/workflows/reusable-docker-build-push.yml with: image_description: GitOps Example API secrets: inherit update-prod-tag: - if: github.event_name == 'push' && github.ref_name == 'main' + if: github.ref_name == 'main' needs: build-and-push uses: ./.github/workflows/reusable-update-prod-tag.yml with: image_name_pattern: amertz08\/gitops-example$ commit_message_label: api secrets: inherit - - register-branch: - if: github.event_name == 'push' && github.ref_name != 'main' - needs: build-and-push - uses: ./.github/workflows/reusable-argocd-register.yml - secrets: inherit - - cleanup-branch: - if: github.event_name == 'delete' && github.event.ref_type == 'branch' - uses: ./.github/workflows/reusable-argocd-cleanup.yml - secrets: inherit diff --git a/.github/workflows/reusable-argocd-cleanup.yml b/.github/workflows/reusable-argocd-cleanup.yml deleted file mode 100644 index 6eb4427..0000000 --- a/.github/workflows/reusable-argocd-cleanup.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Reusable - Cleanup Branch ArgoCD App - -on: - workflow_call: - -permissions: - contents: write - -jobs: - cleanup-branch: - runs-on: ubuntu-latest - steps: - - name: Checkout main - uses: actions/checkout@v4 - with: - ref: main - - - name: Remove branch ArgoCD application - run: | - BRANCH="${{ github.event.ref }}" - SAFE_BRANCH=$(echo "${BRANCH}" | tr '/' '-' | tr '[:upper:]' '[:lower:]') - if [ -f "deploy/argocd/branches/${SAFE_BRANCH}.yaml" ]; then - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git rm deploy/argocd/branches/${SAFE_BRANCH}.yaml - git commit -m "chore: remove ArgoCD app for deleted branch ${BRANCH}" - git pull --rebase origin main - git push origin main - fi diff --git a/.github/workflows/reusable-argocd-register.yml b/.github/workflows/reusable-argocd-register.yml deleted file mode 100644 index a9fe920..0000000 --- a/.github/workflows/reusable-argocd-register.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Reusable - Register Branch with ArgoCD - -on: - workflow_call: - -permissions: - contents: write - -jobs: - register-branch: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Register branch with ArgoCD - run: | - BRANCH="${{ github.ref_name }}" - SAFE_BRANCH=$(echo "${BRANCH}" | tr '/' '-' | tr '[:upper:]' '[:lower:]') - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git fetch origin main - git checkout main - mkdir -p deploy/argocd/branches - cat > deploy/argocd/branches/${SAFE_BRANCH}.yaml <