Adding diagnostics #40
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 and Publish Docker Image | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/tylermarques/u-the-bomb-com:${{ github.sha }} | |
cache-from: type=registry,ref=user/app:latest | |
cache-to: type=inline | |
update-manifests: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
repository: tylermarques/homelab-infra | |
ref: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: homelab-infra/ | |
- name: Update Manifests | |
run: | | |
cd homelab-infra | |
ls -lha | |
apt update && apt install -y yq | |
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 |