All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m25s
61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
name: Gitea Actions Demo
|
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
on: [push]
|
|
|
|
jobs:
|
|
Explore-Gitea-Actions:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 克隆代码
|
|
uses: https://gitea.com/actions/checkout@v4
|
|
## 缓存 Maven 依赖
|
|
# - name: Cache Jdk download
|
|
# uses: https://gitea.com/actions/cache@v3
|
|
# with:
|
|
# path: $RUNNER_TEMP/java_package.tar.gz
|
|
# key: ${{ runner.os }}-jdk-17.0.14
|
|
# restore-keys: ${{ runner.os }}-jdk-17.0.14
|
|
#
|
|
# - name: 下载jdk
|
|
# run: |
|
|
# download_url="https://mirrors.tuna.tsinghua.edu.cn/Adoptium/17/jdk/x64/linux/OpenJDK17U-jdk_x64_linux_hotspot_17.0.14_7.tar.gz"
|
|
# wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
|
|
|
- uses: https://gitea.com/actions/setup-java@v4
|
|
name: 准备jdk
|
|
with:
|
|
distribution: 'jdkfile'
|
|
jdkFile: ${{ runner.temp }}/java_package.tar.gz
|
|
java-version: '21.0.6'
|
|
architecture: x64
|
|
cache: "maven"
|
|
|
|
# 缓存 Maven 依赖
|
|
- name: Cache Maven packages
|
|
uses: https://gitea.com/actions/cache@v3
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ${{ runner.os }}-m2
|
|
|
|
- name: 编译
|
|
run: chmod +x ./mvnw && ./mvnw -s settings.xml -B -Ptrydo -Phuawei clean install -U -DskipTests -Pprod
|
|
|
|
- run: mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: https://gitea.com/docker/login-action@v2
|
|
with:
|
|
registry: git.pintantan.com
|
|
username: tanghuan
|
|
password: th123th123
|
|
|
|
- name: Build and push Docker image
|
|
uses: https://gitea.com/docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: git.pintantan.com/tanghuan/cescide:dev-1.0.0
|
|
|
|
|