84 lines
2.9 KiB
YAML
84 lines
2.9 KiB
YAML
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||
on:
|
||
push:
|
||
branches:
|
||
- master # 监听master分支
|
||
jobs:
|
||
build-and-push:
|
||
runs-on: ubuntu
|
||
strategy:
|
||
matrix:
|
||
service:
|
||
- ruoyi-auth
|
||
- ruoyi-gateway
|
||
- ruoyi-modules/Property
|
||
- ruoyi-modules/ruoyi-gen
|
||
- ruoyi-modules/ruoyi-job
|
||
- ruoyi-modules/ruoyi-resource
|
||
- ruoyi-modules/ruoyi-system
|
||
- ruoyi-modules/ruoyi-workflow
|
||
- ruoyi-modules/Sis
|
||
- ruoyi-visual/ruoyi-monitor
|
||
- ruoyi-visual/ruoyi-nacos
|
||
- ruoyi-seata-server
|
||
- ruoyi-sentinel-dashboard
|
||
- ruoyi-snailjob-server
|
||
steps:
|
||
- name: Set up Node.js
|
||
uses: http://git.missmoc.top/mocheng/setup-node@v3
|
||
with:
|
||
node-version: '16' # 指定需要的 Node.js 版本
|
||
- name: Checkout Repository
|
||
uses: http://git.missmoc.top/mocheng/checkout@v4
|
||
|
||
# - name: Set Up JDK
|
||
# uses: http://git.missmoc.top/mocheng/setup-java@v4
|
||
# with:
|
||
# java-version: '17'
|
||
# distribution: 'temurin'
|
||
# 移除原有的 uses: actions/setup-java@v3 步骤,替换为以下内容
|
||
- name: 使用本地 JDK(ARM 架构)
|
||
run: |
|
||
# 设置 JAVA_HOME 为本地 JDK 路径
|
||
echo "JAVA_HOME=/java17" >> $GITHUB_ENV
|
||
# 将 JDK 的 bin 目录添加到 PATH,确保命令可直接调用(如 java、javac)
|
||
echo "$JAVA_HOME/bin" >> $GITHUB_PATH
|
||
|
||
- name: 验证 JDK 配置
|
||
run: |
|
||
# 检查 Java 版本,确认是否正确指向本地 JDK
|
||
java -version
|
||
# 检查 JAVA_HOME 环境变量
|
||
echo "JAVA_HOME: $JAVA_HOME"
|
||
|
||
|
||
- name: Build Project with Maven
|
||
run: mvn clean package -DskipTests -f ./${{ matrix.service }}/pom.xml
|
||
|
||
- name: Set Up Docker Buildx
|
||
uses: http://git.missmoc.top/mocheng/setup-buildx-action@v3
|
||
|
||
- name: Login to Gitea Container Registry
|
||
uses: http://git.missmoc.top/mocheng/login-action@v3
|
||
with:
|
||
registry: ${{ secrets.REGISTRY_URL }}
|
||
username: ${{ secrets.REGISTRY_USER }}
|
||
password: ${{ secrets.REGISTRY_PASS }}
|
||
|
||
- name: Determine Dockerfile Path
|
||
id: dockerfile-path
|
||
run: |
|
||
if [ "${{ matrix.service }}" = "ruoyi-visual/ruoyi-nacos" ]; then
|
||
echo "dockerfile_path=./ruoyi-visual/ruoyi-nacos/Dockerfile" >> $GITHUB_OUTPUT
|
||
else
|
||
echo "dockerfile_path=./${{ matrix.service }}/Dockerfile" >> $GITHUB_OUTPUT
|
||
fi
|
||
|
||
- name: Build and Push Docker Image
|
||
uses: http://git.missmoc.top/mocheng/build-push-action@v5
|
||
with:
|
||
context: .
|
||
file: ${{ steps.dockerfile-path.outputs.dockerfile_path }}
|
||
tags: ${{ secrets.REGISTRY_URL }}/by2025/${{ matrix.service }}:${{ github.sha }}
|
||
push: true
|