Merge branch 'main' of https://git.scottyah.com/public/scottyah-blog
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m37s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m37s
This commit is contained in:
42
.gitea/workflows/deploy.yaml
Normal file
42
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
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 --tls-verify=false -u "$HARBOR_USERNAME" -p "$HARBOR_PASSWORD" harbor.scottyah.com
|
||||||
|
buildah push --tls-verify=false $IMAGE:${{ github.sha }}
|
||||||
|
buildah push --tls-verify=false $IMAGE:latest
|
||||||
|
env:
|
||||||
|
HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }}
|
||||||
|
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
|
||||||
|
|
||||||
|
- 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