Compare commits
15 Commits
ce3136c047
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f166a4465 | |||
| 50655d26a6 | |||
| 9cf791dd94 | |||
| c6c2426d3a | |||
| ff6062d401 | |||
| f536dd7185 | |||
| 282dbb8c35 | |||
| 9d4a183812 | |||
| 09705a5211 | |||
| 50474abd17 | |||
| a50c8bdba7 | |||
| 154e9039c3 | |||
| cca9457769 | |||
| b7df8c0cc3 | |||
| 439dc9ddef |
@@ -1,26 +0,0 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ github.actor }} is building and pushing 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
# We use single quotes around the secret to prevent shell interpretation
|
||||
# and the VM IP to bypass the 'server' DNS issue.
|
||||
run: |
|
||||
echo '${{ secrets.GITEA_TOKEN }}' | docker login git.chopark.home:3000 --username ${{ github.actor }} --password-stdin
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
run: |
|
||||
docker build -t git.chopark.home:3000/${{ github.repository }}:latest .
|
||||
docker push git.chopark.home:3000/${{ github.repository }}:latest
|
||||
|
||||
- name: List files in the repository
|
||||
run: ls ${{ github.workspace }}
|
||||
|
||||
- run: echo "🍏 Build and Push status is ${{ job.status }}."
|
||||
65
.gitea/workflows/workflow.yaml
Normal file
65
.gitea/workflows/workflow.yaml
Normal file
@@ -0,0 +1,65 @@
|
||||
name: Build and Deploy
|
||||
run-name: ${{ github.actor }} is building and pushing 🚀
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
REGISTRY: git.chopark.home
|
||||
IMAGE: ${{ gitea.repository }} # wesscho/catalog26
|
||||
DEPLOYMENT_NAME: catalog26-deployment # my deployment name
|
||||
CONTAINER_NAME: catalog26 # <-- MUST match spec.template.spec.containers[].name
|
||||
NAMESPACE: catalog # my namespace
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
# We use single quotes around the secret to prevent shell interpretation
|
||||
# and the VM IP to bypass the 'server' DNS issue.
|
||||
run: |
|
||||
echo '${{ secrets.REGISTRY_TOKEN }}' | \
|
||||
docker login ${{ env.REGISTRY }} \
|
||||
--username ${{ gitea.actor }} \
|
||||
--password-stdin
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
run: |
|
||||
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest .
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||
|
||||
- name: List files in the repository
|
||||
run: ls ${{ github.workspace }}
|
||||
|
||||
- run: echo "🍏 Build and Push status is ${{ job.status }}."
|
||||
|
||||
deploy-to-k8s:
|
||||
needs: build-and-push
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container:
|
||||
image: bitnami/kubectl:latest
|
||||
|
||||
steps:
|
||||
- name: Set Kubeconfig
|
||||
run: |
|
||||
echo "${{ secrets.KUBE_CONFIG }}" > kubeconfig.yaml
|
||||
|
||||
- name: Update Deployment Image
|
||||
env:
|
||||
KUBECONFIG: kubeconfig.yaml
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
kubectl set image \
|
||||
"deployment/${DEPLOYMENT_NAME}" \
|
||||
"${CONTAINER_NAME}=${REGISTRY}/${IMAGE}:latest" \
|
||||
-n "${NAMESPACE}"
|
||||
|
||||
# Optional: wait for rollout to complete (recommended)
|
||||
kubectl rollout status "deployment/${DEPLOYMENT_NAME}" -n "${NAMESPACE}"
|
||||
@@ -22,7 +22,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: catalog26
|
||||
image: registry.chopark.home/catalog26:latest # Or yourusername/catalog26:latest for Docker Hub
|
||||
image: git.chopark.home/wesscho/catalog26:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8080 # This must match your Dockerfile EXPOSE port
|
||||
|
||||
Reference in New Issue
Block a user