Add Gitea Actions workflow for build and deploy
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Uses buildah to build/push to Harbor, then kubectl apply for deployment. Replaces the old Woodpecker CI pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
36
.gitea/workflows/deploy.yaml
Normal file
36
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Build and Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: quay.io/buildah/stable
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
run: |
|
||||||
|
IMAGE=harbor.scottyah.com/scottyah/blog
|
||||||
|
buildah 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 push $IMAGE:${{ github.sha }}
|
||||||
|
buildah 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
|
||||||
Reference in New Issue
Block a user