run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 on: push: branches: - master # 替换为要监听的分支 jobs: build-and-push: runs-on: ubuntu-latest 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: Checkout Repository # 使用本地Gitea仓库的checkout action uses: http://47.109.37.87:3000/bichangxiong/checkout@v3 # 如果是私有仓库,可能需要令牌 with: token: ${{ secrets.GITEA_TOKEN }} - name: Set Up JDK # 使用本地Gitea仓库的setup-java action uses: http://47.109.37.87:3000/bichangxiong/java-setup@v3 with: java-version: '17' # 按项目实际Java版本调整 distribution: 'temurin' # 如果需要从本地Maven仓库拉取依赖,可以添加以下配置 server-id: gitea server-username: ${{ secrets.REGISTRY_USER }} server-password: ${{ secrets.REGISTRY_PASS }} - name: Build Project with Maven run: mvn clean package -DskipTests -f ./${{ matrix.service }}/pom.xml env: # 配置Maven使用本地仓库 MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository" - name: Set Up Docker Buildx # 使用本地Gitea仓库的setup-buildx-action uses: http://47.109.37.87:3000/cicd/setup-buildx-action@v2 - name: Login to Gitea Container Registry # 使用本地Gitea仓库的login-action uses: http://47.109.37.87:3000/cicd/login-action@v2 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 # 使用本地Gitea仓库的build-push-action uses: http://47.109.37.87:3000/cicd/build-push-action@v4 with: context: . file: ${{ steps.dockerfile-path.outputs.dockerfile_path }} tags: ${{ secrets.REGISTRY_URL }}/by2025/${{ matrix.service }}:${{ github.sha }} push: true