diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 8cb63c9..8f0ae1e 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -1,4 +1,4 @@ -name: Gitea Actions Demo +name: 自动流水线示例 run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 on: pull_request: @@ -19,17 +19,17 @@ on: # - cron: '30 5 * * 2,4' jobs: - Explore-Gitea-Actions: + 构建应用: runs-on: ubuntu-latest steps: # https://github.com/actions/checkout - - name: Checkout code + - name: 下载代码 uses: actions/checkout@v4 - run: | echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - name: Get commit message (Push) + - name: 获取提交的消息 if: github.event_name == 'push' run: | echo "提交的信息: ${{ github.event.head_commit.message }}" @@ -54,7 +54,7 @@ jobs: echo "不包含" exit 1 fi - - name: Get commit message (Pull Request) + - name: 获取合并请求的消息 if: github.event_name == 'pull_request' run: | echo "是否是合并关闭的 $PR_STATUS_FLAG" @@ -79,18 +79,18 @@ jobs: env: PR_STATUS_FLAG: ${{ github.event.pull_request.merged }} # https://github.com/actions/setup-node 和 https://cicube.io/workflow-hub/github-action-setup-node/ - - name: nodejs + - name: 安装nodejs uses: actions/setup-node@v4 with: node-version: '22' check-latest: true # cache: 'npm' # cache-dependency-path: '**/package-lock.json' - - name: Install dependencies + - name: 安装node依赖 run: npm --version - - name: Run tests + - name: 运行node测试 run: echo "npm test 成功actions/github-script@v5创建合并请求" - - name: Set up JDK 17 + - name: 安装JDK uses: actions/setup-java@v4 with: distribution: 'temurin' # See 'Supported distributions' for available options @@ -98,16 +98,22 @@ jobs: check-latest: true cache: 'maven' # cache-dependency-path: 'sub-project/pom.xml' # optional - - name: Set up Maven + - name: 安装Maven uses: stCarolas/setup-maven@v5 with: maven-version: 3.9.11 - - name: Build with Maven + - name: Maven打包 run: | echo "mvn clean install -DskipTests && mvn -B package --file pom.xml" mvn --version + - name: 构建镜像并推送 + run: | + echo 'docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}"' + echo 'docker build -t .' + echo 'docker push :latest' + docker info - - name: List files in the repository + - name: 列出工作目录列表 run: | ls ${{ gitea.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file