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