Compare commits

...

3 Commits

Author SHA1 Message Date
bamanker
a29c9c1085 修改了一些问题
Some checks failed
Build Push and Deploy Image / build (push) Failing after 24m59s
2025-12-29 17:43:49 +08:00
bamanker
838e811619 修改了无法找到node的问题
Some checks failed
Build Push and Deploy Image / build (push) Failing after 4m48s
2025-12-29 17:23:04 +08:00
bamanker
e02119c1f3 action环境切换到ubuntu镜像
Some checks failed
Build Push and Deploy Image / build (push) Failing after 7m56s
2025-12-29 16:34:10 +08:00

View File

@@ -21,12 +21,16 @@ env:
# 构建 Job
jobs:
build:
runs-on: host
runs-on: ubuntu-latest #如果host构建 linux_amd64
steps:
- run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event."
- run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
- run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- run: env
# 下载仓库源码依赖node环境因此构建服务器本地需要下载安装node并设置环境变量
- name: Checkout repository code
#使用自定义仓库action
uses: http://139.9.216.111:3000/bamanker/checkout@v6
uses: http://localhost:3000/bamanker/checkout@v6
# 获取 TAG 并设置为环境变量
- name: Get version
@@ -50,13 +54,20 @@ jobs:
cat ./deployment.yml
# 构建java项目
- name: Set up Java
uses: http://localhost:3000/bamanker/setup-java@v5
with:
distribution: 'graalvm'
java-version: '25.0.1'
cache: 'maven'
- name: Build with Maven
#使用maven绝对路径执行打包命令
run: /usr/local/maven/bin/mvn clean native:compile -DskipTests -Pprod
run: mvn clean native:compile -DskipTests -Pnative
# 登录镜像仓库,方便后续上传镜像
- name: Login to Docker Registry
uses: http://139.9.216.111:3000/bamanker/login-action@v3
uses: http://localhost:3000/bamanker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -71,7 +82,7 @@ jobs:
# 构建并上传镜像
- name: Build and push Docker image
uses: http://139.9.216.111:3000/bamanker/build-push-action@v6 # 获取上一步截取到的版本号,既 1.0.0
uses: http://localhost:3000/bamanker/build-push-action@v6 # 获取上一步截取到的版本号,既 1.0.0
#只能这样接收
env:
TAG: ${{ steps.set_envar.outputs.tag }}
@@ -83,7 +94,11 @@ jobs:
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
#发布到 k8s
- name: Generate kubeconfig and deploy
- name: Generate kubeconfig
uses: http://localhost:3000/bamanker/kubectl-action@v1.4.0
with:
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
- name: Deploy k8s
run: kubectl apply -f ./deployment.yml
# command: apply -f http://139.9.216.111:3000/bamanker/myk3sTest/raw/branch/master/.deploy/deployment-temp.yml
- name: k8s Check Pods Health