Update argocd deployment to staging and prod #10
This file contains 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: Build & Deploy | |
on: | |
pull_request: {} | |
push: | |
branches: | |
- "main" | |
jobs: | |
build_and_push_images: | |
name: Build and push images | |
runs-on: | |
- self-hosted | |
- dind | |
- large-8x8 | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Check out the coredb repo to reuse some actions | |
uses: actions/checkout@v4 | |
with: | |
repository: tembo-io/tembo | |
path: ./.tembo | |
ref: 3714d336a0efdfc82234db7ccb708ecf80346e84 | |
- name: Determine which tags to publish | |
id: tags | |
run: | | |
BRANCH_NAME="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" | |
echo "using branch: ${BRANCH_NAME}" | |
if [ "${BRANCH_NAME}" == "main" ]; then | |
echo "tag_latest=true" >> $GITHUB_OUTPUT | |
echo "tag_cargo=true" >> $GITHUB_OUTPUT | |
else | |
echo "tag_latest=false" >> $GITHUB_OUTPUT | |
echo "tag_cargo=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Build and upload image | |
uses: ./.tembo/.github/actions/build-and-push-to-quay | |
with: | |
image_name: tembo-metrics | |
docker_directory: ./ | |
# Tag with version in Cargo.toml | |
# if that file is present | |
# and if the branch is 'main' or starts with 'release/' | |
tag_cargo_version_if_present: ${{ steps.tags.outputs.tag_cargo }} | |
# Tag with 'latest' | |
# if the branch is 'main' | |
publish_latest: ${{ steps.tags.outputs.tag_latest }} | |
# If we are publishing latest, also tag it with calver | |
publish_calver: ${{ steps.tags_outputs.tag_latest }} | |
registry: "quay.io/tembo" | |
quay_user: ${{ secrets.QUAY_USER_TEMBO }} | |
quay_password: ${{ secrets.QUAY_PASSWORD_TEMBO }} | |
argocd_update: | |
name: ArgoCD update automation | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- repository: tembo-io/app-deploy-dev | |
subdirectory: dev | |
branch: main | |
- repository: tembo-io/app-deploy | |
subdirectory: staging | |
branch: staging-updates | |
- repository: tembo-io/app-deploy | |
subdirectory: prod | |
branch: prod-updates | |
needs: | |
- build_and_push_images | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set short_sha | |
id: sha | |
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Check out the repo | |
uses: ./.github/actions/argocd-update | |
with: | |
repository: ${{ matrix.repository }} | |
ssh_key: ${{ secrets.SERVICE_USER_GITHUB_SSH_KEY }} | |
branch: ${{ matrix.branch }} | |
version: ${{ steps.sha.outputs.short_sha }} | |
subdirectory: ${{ matrix.subdirectory }} |