Skip to content

Commit

Permalink
feat: 调整镜像构建的tag,让最新代码指向latest,让每次版本指向日期 (Chanzhaoyu#144)
Browse files Browse the repository at this point in the history
* feat: 调整镜像构建的tag,让最新代码指向latest,让每次版本指向日期

* feat: 触发时机为main分支push或者relases的create,镜像的tag为分支名或tag名

* fix: 修复变量引用方式

* fix: 修复变量引用方式

* fix: 使用github.ref_name 取触发action的来源
  • Loading branch information
eryajf authored Feb 27, 2023
1 parent 4769c31 commit 2c509c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: build_docker
on:
push:
branches: [main]
release:
types: [created] # 表示在创建新的 Release 时触发

jobs:
build_docker:
Expand All @@ -11,11 +13,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: chenzhaoyu94/chatgpt-web

- run: |
echo "本次构建的版本为:${GITHUB_REF_NAME} (但是这个变量目前上下文中无法获取到)"
echo 本次构建的版本为:${{ github.ref_name }}
env
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -32,6 +34,8 @@ jobs:
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/chatgpt-web:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/chatgpt-web:latest
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ version: '3'

services:
app:
image: chenzhaoyu94/chatgpt-web:main
image: chenzhaoyu94/chatgpt-web # 总是使用latest,更新时重新pull该tag镜像即可
ports:
- 3002:3002
environment:
Expand Down

0 comments on commit 2c509c3

Please sign in to comment.