feat: add gitea workflows

This commit is contained in:
Gusram
2025-07-01 15:58:51 +08:00
parent e2c497d313
commit fa399a2263
7 changed files with 297 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
name: Deploy to Kube AWS Cronjob
on:
workflow_call:
inputs:
app-name:
required: true
type: string
app-target:
required: true
type: string
image-tag:
required: true
type: string
secrets:
REGISTRY:
required: true
EKS_KEY:
required: true
EKS_SECRET:
required: true
jobs:
deploy-k8s-eks-cron:
name: Deploy Cronjob
runs-on: ubuntu-js-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{secrets.EKS_KEY}}
aws-secret-access-key: ${{secrets.EKS_SECRET}}
aws-region: ap-southeast-3
- name: Deploy
env:
REGISTRY: ${{ secrets.REGISTRY }}
APP: ${{ inputs.app-name }}
APPTARGET: ${{inputs.app-target}}
TAG: ${{inputs.image-tag}}
run: |
curl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.24.7/2022-10-31/bin/linux/amd64/kubectl
chmod +x kubectl
mv kubectl /usr/local/bin/
cd ~
mkdir .kube
aws eks update-kubeconfig --region ap-southeast-3 --name btwedutech
kubectl set image cronjob/$APP $APPTARGET=$REGISTRY:$TAG

View File

@@ -0,0 +1,50 @@
name: Deploy to Kube AWS
on:
workflow_call:
inputs:
app-name:
required: true
type: string
app-target:
required: true
type: string
image-tag:
required: true
type: string
secrets:
REGISTRY:
required: true
EKS_KEY:
required: true
EKS_SECRET:
required: true
jobs:
deploy-k8s-eks:
name: Deploy to deployment EKS
runs-on: ubuntu-js-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{secrets.EKS_KEY}}
aws-secret-access-key: ${{secrets.EKS_SECRET}}
aws-region: ap-southeast-3
- name: Deploy
env:
REGISTRY: ${{ secrets.REGISTRY }}
APP: ${{ inputs.app-name }}
APPTARGET: ${{inputs.app-target}}
TAG: ${{inputs.image-tag}}
run: |
curl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.24.7/2022-10-31/bin/linux/amd64/kubectl
chmod +x kubectl
mv kubectl /usr/local/bin/
cd ~
mkdir .kube
aws eks update-kubeconfig --region ap-southeast-3 --name btwedutech
kubectl set image deployment/$APP $APPTARGET=$REGISTRY:$TAG
kubectl rollout restart deployment/$APP

View File

@@ -0,0 +1,40 @@
name: Deploy to Kube Cronjob
on:
workflow_call:
inputs:
app-name:
required: true
type: string
app-target:
required: true
type: string
image-tag:
required: true
type: string
secrets:
REGISTRY:
required: true
K8S_CONFIG:
required: true
jobs:
deploy-k8s:
name: Deploy Cronjob
runs-on: ubuntu-js-latest
steps:
- name: Deploy
env:
K8S_CONFIG: ${{secrets.K8S_CONFIG}}
REGISTRY: ${{ secrets.REGISTRY }}
APP: ${{ inputs.app-name }}
APPTARGET: ${{inputs.app-target}}
TAG: ${{inputs.image-tag}}
run: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x kubectl
mv kubectl /usr/local/bin/
cd ~
mkdir .kube
echo "$K8S_CONFIG" > .kube/config
kubectl set image cronjob/$APP $APPTARGET=$REGISTRY:$TAG

View File

@@ -0,0 +1,51 @@
name: Deploy to Kube GKE Cronjob
on:
workflow_call:
inputs:
app-name:
required: true
type: string
app-target:
required: true
type: string
image-tag:
required: true
type: string
secrets:
REGISTRY:
required: true
GKE_SA_KEY:
required: true
GKE_CLUSTER_NAME:
required: true
GKE_ZONE_NAME:
required: true
GKE_PROJECT_ID:
required: true
jobs:
deploy-k8s-gke-cron:
name: Deploy Cronjob
runs-on: ubuntu-js-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Authenticate Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- name: Configure GKE credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ secrets.GKE_CLUSTER_NAME }}
location: ${{ secrets.GKE_ZONE_NAME }}
project_id: ${{ secrets.GKE_PROJECT_ID }}
- name: Deploy
env:
REGISTRY: ${{ secrets.REGISTRY }}
APP: ${{ inputs.app-name }}
APPTARGET: ${{inputs.app-target}}
TAG: ${{inputs.image-tag}}
run: |
kubectl set image cronjob/$APP $APPTARGET=$REGISTRY:$TAG

View File

@@ -0,0 +1,52 @@
name: Deploy to Kube GKE
on:
workflow_call:
inputs:
app-name:
required: true
type: string
app-target:
required: true
type: string
image-tag:
required: true
type: string
secrets:
REGISTRY:
required: true
GKE_SA_KEY:
required: true
GKE_CLUSTER_NAME:
required: true
GKE_ZONE_NAME:
required: true
GKE_PROJECT_ID:
required: true
jobs:
deploy-k8s-gke:
name: Deploy to deployment GKE
runs-on: ubuntu-js-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Authenticate Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- name: Configure GKE credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ secrets.GKE_CLUSTER_NAME }}
location: ${{ secrets.GKE_ZONE_NAME }}
project_id: ${{ secrets.GKE_PROJECT_ID }}
- name: Deploy
env:
REGISTRY: ${{ secrets.REGISTRY }}
APP: ${{ inputs.app-name }}
APPTARGET: ${{inputs.app-target}}
TAG: ${{inputs.image-tag}}
run: |
kubectl set image deployment/$APP $APPTARGET=$REGISTRY:$TAG
kubectl rollout restart deployment/$APP

View File

@@ -0,0 +1,41 @@
name: Deploy to Kube
on:
workflow_call:
inputs:
app-name:
required: true
type: string
app-target:
required: true
type: string
image-tag:
required: true
type: string
secrets:
REGISTRY:
required: true
K8S_CONFIG:
required: true
jobs:
deploy-k8s:
name: Deploy to deployment
runs-on: ubuntu-js-latest
steps:
- name: Deploy
env:
K8S_CONFIG: ${{secrets.K8S_CONFIG}}
REGISTRY: ${{ secrets.REGISTRY }}
APP: ${{ inputs.app-name }}
APPTARGET: ${{inputs.app-target}}
TAG: ${{inputs.image-tag}}
run: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x kubectl
mv kubectl /usr/local/bin/
cd ~
mkdir .kube
echo "$K8S_CONFIG" > .kube/config
kubectl set image deployment/$APP $APPTARGET=$REGISTRY:$TAG
kubectl rollout restart deployment/$APP

14
.gitea/workflows/osv.yml Normal file
View File

@@ -0,0 +1,14 @@
name: Package Vulnerability Scanning
on: [workflow_call]
jobs:
osv-scanner:
runs-on: ubuntu-js-latest
name: OSV Scanner
container: registry.btwazure.com/marvelousbtw/osv-scanner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run OSV Scanner
run: |
test -f ./osv-config.toml && osv-scanner --config=./osv-config.toml -r . || osv-scanner -r .