Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f782c8327 | ||
|
|
a92abc0425 | ||
|
|
2c7953a17e | ||
|
|
f279baf126 |
@@ -2,9 +2,9 @@ name: Build Push and Deploy Image
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
# #tag 触发
|
#tag 触发
|
||||||
# tags:
|
tags:
|
||||||
# - 'v*'
|
- 'v*'
|
||||||
# 分支触发
|
# 分支触发
|
||||||
# branches:
|
# branches:
|
||||||
# - main
|
# - main
|
||||||
@@ -35,7 +35,9 @@ jobs:
|
|||||||
#检查java版本
|
#检查java版本
|
||||||
- name: Get version
|
- name: Get version
|
||||||
id: get_version
|
id: get_version
|
||||||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
# e.g. refs/tags/v1.0.0
|
||||||
|
run: |
|
||||||
|
echo "version=${GITHUB_REF/refs\/tags\/v}" >> $GITHUB_OUTPUT
|
||||||
- name: Check java version
|
- name: Check java version
|
||||||
run: java -version
|
run: java -version
|
||||||
- name: Show now path
|
- name: Show now path
|
||||||
@@ -53,7 +55,7 @@ jobs:
|
|||||||
# 这里也可以通过 secrets 传入,后面再介绍
|
# 这里也可以通过 secrets 传入,后面再介绍
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
# 获取时间戳,用于设置镜像 TAG 版本
|
# 获取时间戳
|
||||||
- name: Get datetime
|
- name: Get datetime
|
||||||
id: datetime
|
id: datetime
|
||||||
run: |
|
run: |
|
||||||
@@ -61,13 +63,15 @@ jobs:
|
|||||||
|
|
||||||
# 构建并上传镜像
|
# 构建并上传镜像
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: http://139.9.216.111:3000/bamanker/build-push-action@v6
|
uses: http://139.9.216.111:3000/bamanker/build-push-action@v6 # 获取上一步截取到的版本号,既 1.0.0
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.get_version.outputs.version }}
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:{{ steps.get_version.outputs.VERSION }}
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||||
|
|
||||||
|
|
||||||
- name: k8s Check and Apply New Deployment
|
- name: k8s Check and Apply New Deployment
|
||||||
|
|||||||
Reference in New Issue
Block a user