Skip to content

Commit

Permalink
fix: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yl2356 committed Mar 30, 2022
1 parent 017156c commit 20dbe5a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
49 changes: 25 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,36 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
- name: Get the version

- name: Get Version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
shell: bash
-
name: Login to Docker Hub

- name: Login Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/ddns:${{ steps.get_version.outputs.VERSION }}
-
name: Build and push latest
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/ddns:latest

- name: Build and Push Docker
shell: bash
run: |
SERVICE_NAME=ddns
TARGET_PATH=build
DOCKER_REPO=gitsang
VERSION=${{ steps.get_version.outputs.VERSION }}
mkdir -p ${TARGET_PATH} ${TARGET_PATH}/bin ${TARGET_PATH}/conf ${TARGET_PATH}/log
go build ${LD_FLAGS} -o ${TARGET_PATH}/bin/${SERVICE_NAME} cmd/${SERVICE_NAME}.go
cp configs/template.yml ${TARGET_PATH}/conf
docker build -f Dockerfile --no-cache \
--build-arg DOCKER_PACKAGE_PATH=${TARGET_PATH} \
-t ${DOCKER_REPO}/${SERVICE_NAME}:${VERSION} .
docker tag ${DOCKER_REPO}/${SERVICE_NAME}:${VERSION} ${DOCKER_REPO}/${SERVICE_NAME}:latest
docker push ${DOCKER_REPO}/${SERVICE_NAME}:${VERSION}
docker push ${DOCKER_REPO}/${SERVICE_NAME}:latest
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func LoadConfig(file string) error {
AutoReload: true,
AutoReloadInterval: time.Minute,
AutoReloadCallback: func(config interface{}) {
log.Debug("config auto reload", zap.Reflect("Cfg", Cfg))
log.Info("config auto reload", zap.Reflect("Cfg", Cfg))
},
}).Load(&Cfg, file)
if err != nil {
Expand Down

0 comments on commit 20dbe5a

Please sign in to comment.