Skip to content

Commit

Permalink
Fixing dev to work like prod
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Marques <me@tylermarques.com>
  • Loading branch information
Tylermarques committed Jun 12, 2024
1 parent 011e415 commit 7a90b5b
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions .github/workflows/build-and-push-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,20 @@ name: Build and Publish Docker Image
on:
push:
branches:
- dev
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
environment: github-actions

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -32,29 +26,34 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
permissions: write-all
context: .
push: true
tags: ghcr.io/tylermarques/u-the-bomb-com:dev
tags: ghcr.io/tylermarques/u-the-bomb-com:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

update-manifests:
needs: build
runs-on: ubuntu-latest
environment: github-actions
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: tylermarques/homelab-infra
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.HOMELAB_GITHUB_PAT }}
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/dev/kustomization.yaml -i
git commit -am 'Increment image tag'
git commit -m "Update manifests"
yq e '(.images[] | select(.name == "u-the-bomb-com") | .newTag) = "'${{ github.sha }}'"' apps/u-the-bomb-com/production/kustomization.yaml -i
git commit -am 'Push from ${{ github.actor }} to ${{ github.repository }}'
git push

0 comments on commit 7a90b5b

Please sign in to comment.