From fd5ec93ae4629e8b7eccb27319119daebc370c9c Mon Sep 17 00:00:00 2001 From: Tyler Marques Date: Tue, 11 Jun 2024 20:12:25 -0400 Subject: [PATCH] Trying a change to the actions to update the manifests Signed-off-by: Tyler Marques --- .github/workflows/build-and-push-dev.yaml | 24 ++++++++++++++++++++--- .github/workflows/build-and-push.yaml | 23 ++++++++++++++++++++-- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-push-dev.yaml b/.github/workflows/build-and-push-dev.yaml index 0f0df7f..52433d7 100644 --- a/.github/workflows/build-and-push-dev.yaml +++ b/.github/workflows/build-and-push-dev.yaml @@ -38,6 +38,24 @@ jobs: context: . push: true tags: ghcr.io/tylermarques/u-the-bomb-com:dev - - - name: Post build info - run: echo "Docker image has been built and pushed to Docker Hub." + update-manifests: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + repository: tylermarques/homelab-infra + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update Manifests + run: | + apt update && apt install -y yq + cd homelab-infra + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + yq e '(.images[] | select(.name == "u-the-bomb-com") | .newTag) = "'${{ github.sha }}'"' apps/u-the-bomb-com/dev/kustomization.yaml -i + git commit -am 'Increment image tag' + git commit -m "Update manifests" + git push diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml index 4f2c282..ddc2252 100644 --- a/.github/workflows/build-and-push.yaml +++ b/.github/workflows/build-and-push.yaml @@ -39,5 +39,24 @@ jobs: push: true tags: ghcr.io/tylermarques/u-the-bomb-com:prod - - name: Post build info - run: echo "Docker image has been built and pushed to Docker Hub." + update-manifests: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + repository: tylermarques/homelab-infra + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update Manifests + run: | + apt update && apt install -y yq + cd homelab-infra + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + yq e '(.images[] | select(.name == "u-the-bomb-com") | .newTag) = "'${{ github.sha }}'"' apps/u-the-bomb-com/prod/kustomization.yaml -i + git commit -am 'Increment image tag' + git commit -m "Update manifests" + git push