update workflows build-and-push-image

This commit is contained in:
fatedier 2020-09-23 14:20:46 +08:00
parent 3fbdea0f6b
commit cd5314466c

View File

@ -1,13 +1,15 @@
name: Build Image and Publish to Dockerhub & GPR name: Build Image and Publish to Dockerhub & GPR
on: on:
push:
branches: [ test-build ]
release: release:
types: [ created ] types: [ created ]
workflow_dispatch:
inputs:
tag:
description: 'Image tag'
required: true
default: 'test'
jobs: jobs:
binary: binary:
name: Build Golang project name: Build Golang project
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -68,21 +70,25 @@ jobs:
with: with:
name: frps name: frps
path: bin/frps path: bin/frps
# get release name # get image tag name
- -
name: Get Release Name name: Get Image Tag Name
run: | run: |
echo ::set-env name=RELEASE_NAME::${GITHUB_REF#refs/*/} if [ x${{ github.event.inputs.logLevel }} == x"" ]; then
echo ::set-env name=TAG_NAME::${GITHUB_REF#refs/*/}
else
echo ::set-env name=TAG_NAME::${{ github.event.inputs.tag }}
fi
# prepare image tags # prepare image tags
- -
name: Prepare Image Tags name: Prepare Image Tags
run: | run: |
echo ::set-env name=DOCKERFILE_FRPC_PATH::dockerfiles/Dockerfile-for-frpc echo ::set-env name=DOCKERFILE_FRPC_PATH::dockerfiles/Dockerfile-for-frpc
echo ::set-env name=DOCKERFILE_FRPS_PATH::dockerfiles/Dockerfile-for-frps echo ::set-env name=DOCKERFILE_FRPS_PATH::dockerfiles/Dockerfile-for-frps
echo ::set-env name=TAG_FRPC::fatedier/frpc:$RELEASE_NAME echo ::set-env name=TAG_FRPC::fatedier/frpc:$TAG_NAME
echo ::set-env name=TAG_FRPS::fatedier/frps:$RELEASE_NAME echo ::set-env name=TAG_FRPS::fatedier/frps:$TAG_NAME
echo ::set-env name=TAG_FRPC_GPR::ghcr.io/${{ github.repository}}/frpc:$RELEASE_NAME echo ::set-env name=TAG_FRPC_GPR::ghcr.io/fatedier/frpc:$TAG_NAME
echo ::set-env name=TAG_FRPS_GPR::ghcr.io/${{ github.repository}}/frps:$RELEASE_NAME echo ::set-env name=TAG_FRPS_GPR::ghcr.io/fatedier/frps:$TAG_NAME
# build images # build images
- -
name: Build Images name: Build Images