Files
scottyah-blog/.gitea/workflows/deploy.yaml
Scott Hatlen e66132a184
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 40s
Use buildah --isolation chroot for container builds
2026-03-09 19:32:45 -07:00

40 lines
1.4 KiB
YAML

name: Build and Deploy
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
container:
image: quay.io/buildah/stable
steps:
- name: Checkout
run: |
git clone --depth 1 --branch "${{ github.ref_name }}" "${{ github.server_url }}/${{ github.repository }}.git" .
git checkout "${{ github.sha }}"
- name: Build image
run: |
IMAGE=harbor.scottyah.com/scottyah/blog
buildah --isolation chroot bud -t $IMAGE:${{ github.sha }} -t $IMAGE:latest .
- name: Push image
run: |
IMAGE=harbor.scottyah.com/scottyah/blog
buildah login -u "${{ secrets.HARBOR_USERNAME }}" -p "${{ secrets.HARBOR_PASSWORD }}" harbor.scottyah.com
buildah --isolation chroot push $IMAGE:${{ github.sha }}
buildah --isolation chroot push $IMAGE:latest
- name: Deploy
run: |
curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG_DATA }}" | base64 -d > ~/.kube/config
sed -i "s|harbor.scottyah.com/scottyah/blog:latest|harbor.scottyah.com/scottyah/blog:${{ github.sha }}|" k8s.yaml
./kubectl apply -f k8s.yaml
./kubectl rollout status deployment/blog-dep -n blog --timeout=120s