Skip to content

Commit

Permalink
ci: docker镜像构建
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Jul 4, 2024
1 parent 0ac1a6b commit be84a09
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ on:
branches:
- main

push:
tags:
- 'v*'

env:
APP_NAME: ${{ github.event.repository.name }}
NAMESPACE: app
REGISTRY: ${{ secrets.DOCKER_REGISTRY && secrets.DOCKER_REGISTRY || 'docker.io' }}
REPOSITORY: ${{ github.repository }}
# 判断是否是tag,是的话就使用tag作为版本号,否则使用branch
IMAGE_TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref || '' }}
IMAGE_LATEST_TAG: ${{ startsWith(github.ref, 'refs/tags/') && 'latest' || 'main' }}

jobs:
docker:
Expand Down Expand Up @@ -67,5 +74,6 @@ jobs:
with:
push: true
file: Dockerfile
tags: codfrm/dns-kit:main,codfrm/dns-kit:${{ steps.vars.outputs.sha_short }}
# 如果IMAGE_TAG为空,则使用${{ steps.vars.outputs.sha_short }}
tags: codfrm/dns-kit:${{ env.IMAGE_LATEST_TAG }},codfrm/dns-kit:${{ env.IMAGE_TAG && env.IMAGE_TAG || steps.vars.outputs.sha_short }}
context: .
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/alibabacloud-go/sts-20150401/v2 v2.0.2
github.com/alibabacloud-go/tea v1.2.1
github.com/cloudflare/cloudflare-go v0.92.0
github.com/codfrm/cago v0.0.0-20240503013413-9ffc0bcb32b5
github.com/codfrm/cago v0.0.0-20240704094737-a6f28eee8c54
github.com/gin-gonic/gin v1.9.1
github.com/go-gormigrate/gormigrate/v2 v2.1.2
github.com/jarcoal/httpmock v1.3.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/codfrm/cago v0.0.0-20240503013413-9ffc0bcb32b5 h1:zKwFrQgOrRSaxBNMybpblS60SlSZdP6UTdXDd6IcpBs=
github.com/codfrm/cago v0.0.0-20240503013413-9ffc0bcb32b5/go.mod h1:hHL3Yv8Oim3/1C7SHpHBZ4QjKZG2tm/rP+yOCRoWHWE=
github.com/codfrm/cago v0.0.0-20240704094737-a6f28eee8c54 h1:QM0tx2nPIrcVpf3OOMdwbySaPJDc07Ao263FKpEGtls=
github.com/codfrm/cago v0.0.0-20240704094737-a6f28eee8c54/go.mod h1:008qw8aJuWrCj3py8hdymBaO/72g1dfu3JepBdQu5fE=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/dave/jennifer v1.6.1/go.mod h1:nXbxhEmQfOZhWml3D1cDK5M1FLnMSozpbFN/m3RmGZc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down

0 comments on commit be84a09

Please sign in to comment.