1
0
forked from lxh/go-wxhelper

💚 优化Actions工作流配置

This commit is contained in:
李寻欢 2023-10-25 09:53:25 +08:00
parent 745dabbffd
commit 301e75cf0c

View File

@ -26,23 +26,29 @@ jobs:
- name: Gen Tags
id: gen_tags
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: gitee.ltd/lxh/go-wxhelper
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Print Tags
run: |
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
TAGS='["gitee.ltd/lxh/go-wxhelper:latest","gitee.ltd/lxh/go-wxhelper:'${GITHUB_REF/refs\/tags\//}'"]'
else
TAGS='["gitee.ltd/lxh/go-wxhelper:latest"]'
fi
echo '::set-output name=tags::'$TAGS
echo ${{ steps.gen_tags.outputs.tags }}
echo "----------------- labels -----------------"
echo ${{ steps.meta.outputs.labels }}
- name: Login to Repository
uses: docker/login-action@v2
with:
registry: gitee.ltd
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
# - name: Login to Repository
# uses: docker/login-action@v2
# with:
# registry: gitee.ltd
# username: ${{ secrets.USERNAME }}
# password: ${{ secrets.PASSWORD }}
- name: Build image
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ fromJson(steps.gen_tags.outputs.tags) }}
# - name: Build image
# uses: docker/build-push-action@v2
# with:
# push: true
# tags: ${{ fromJson(steps.gen_tags.outputs.tags) }}