From 79979c9825b1bc70af8184b3e6ba7598c01ac427 Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Thu, 18 Jan 2024 10:00:00 +0800 Subject: [PATCH] add github CI-CD --- .github/workflows/main.yml | 43 ++++++++++++++++++++++++++++++++++++++ pom.xml | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..fdea07c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,43 @@ +name: Java CI-CD with Maven + +on: + push: + tags: + - '*' + +jobs: + build: +# 配置权限 + permissions: write-all + runs-on: ubuntu-latest + steps: +# 下载代码 + - uses: actions/checkout@v3 + - name: Set up JDK 17 +# 安装 JDK + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven +# Maven 打包 + - name: Build with Maven + run: mvn -B package --file pom.xml +# 将打包好的 Jar 包 放到 staging 文件夹 + - run: mkdir staging && cp target/*.jar staging +# 设置 jobs Maven pom 版本环境变量 + - name: Set Release version env variable + run: | + echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + - name: "Build & test" + run: | + echo "done!" +# 上传文件并发布 Release + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.RELEASE_VERSION }}" + prerelease: false + title: "Release ${{ env.RELEASE_VERSION }}" + files: | + staging/*.jar diff --git a/pom.xml b/pom.xml index e917d66..4889e5a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.lunadeer MiniPlayerTitle - 2.7.1 + 2.7.2 jar MiniPlayerTitle