2024-04-15 22:29:53 +08:00
|
|
|
|
name: wx_post
|
2024-04-15 21:25:42 +08:00
|
|
|
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
|
|
# 工作流程,可包含多个作业
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
|
|
# 作业1名称
|
2024-04-15 22:29:53 +08:00
|
|
|
|
wx_post-Gitea-Actions:
|
2024-04-15 21:25:42 +08:00
|
|
|
|
# 指定的运行器环境
|
2024-04-16 01:21:43 +08:00
|
|
|
|
runs-on: java-tools-latest
|
2024-04-15 21:25:42 +08:00
|
|
|
|
|
|
|
|
|
# 作业包含一系列任务,称为 steps
|
|
|
|
|
steps:
|
2024-04-15 22:54:26 +08:00
|
|
|
|
- uses: actions/checkout@v4
|
2024-04-15 21:45:09 +08:00
|
|
|
|
- name: Set up JDK 8
|
2024-04-15 22:54:26 +08:00
|
|
|
|
uses: actions/setup-java@v4
|
2024-04-15 21:25:42 +08:00
|
|
|
|
with:
|
2024-04-15 21:40:05 +08:00
|
|
|
|
java-version: '8'
|
2024-04-15 21:45:09 +08:00
|
|
|
|
distribution: 'adopt'
|
2024-04-15 21:25:42 +08:00
|
|
|
|
# maven缓存,不加的话每次都会去重新拉取,会影响速度
|
2024-04-16 02:44:14 +08:00
|
|
|
|
# - name: Dependies Cache
|
|
|
|
|
# uses: actions/cache@v2
|
|
|
|
|
# with:
|
|
|
|
|
# path: ~/.m2/repository
|
|
|
|
|
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
|
|
|
|
# restore-keys: |
|
|
|
|
|
# ${{ runner.os }}-maven-
|
2024-04-15 21:25:42 +08:00
|
|
|
|
# 编译打包
|
|
|
|
|
- name: Build with Maven
|
|
|
|
|
run: |
|
|
|
|
|
mvn package -Dmaven.test.skip=true
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
id: buildx
|
2024-04-16 02:44:14 +08:00
|
|
|
|
uses: docker/setup-buildx-action@v3
|
2024-04-15 21:25:42 +08:00
|
|
|
|
#build镜像并push到中央仓库中
|
|
|
|
|
- name: Build and push
|
|
|
|
|
id: docker_build
|
2024-04-16 02:44:14 +08:00
|
|
|
|
uses: docker/build-push-action@v5
|
2024-04-15 21:25:42 +08:00
|
|
|
|
with:
|
|
|
|
|
context: ./
|
2024-04-15 22:29:53 +08:00
|
|
|
|
file: ./dockerfile
|
2024-04-15 21:25:42 +08:00
|
|
|
|
push: true
|
2024-04-15 22:29:53 +08:00
|
|
|
|
tags: k2.xuthus83.cn:6001/wx_post:latest
|
2024-04-15 21:25:42 +08:00
|
|
|
|
# - name: Build the Docker image
|
|
|
|
|
# run:
|
|
|
|
|
# | # 使用 上一步写的 Dockerfile 构建镜像并发布到私有仓库; 发布完成可以去 https://github.com/MrGaoGang?tab=packages 查看
|
|
|
|
|
# docker build . --file Dockerfile.build --tag k2.xuthus83.cn:6001/pigallery2:latest .
|
|
|
|
|
# docker push k2.xuthus83.cn:6001/pigallery2:latest
|