diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b9d74de5..5668fa22 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -57,6 +57,24 @@ jobs: version-file: ./deploy/chart/alb/Chart.yaml version-file-extraction-pattern: 'version: v([0-9]*\.[0-9]*\.[0-9]*)' - uses: docker/setup-buildx-action@v3 + - name: set release type + env: + RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}" + run: | + branch=$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | sed 's|/|-|g') + echo "branch is $branch" + if [[ "$RELEASE_ME" == "false" ]] && [[ "$branch" == "master" ]] ;then + echo "in master we still want to a pre-release" + echo "RELEASE_TYPE=pre-release" >> $GITHUB_ENV + exit + fi + if [[ "$RELEASE_ME" == "true" ]] ;then + echo "release it" + echo "RELEASE_TYPE=release" >> $GITHUB_ENV + exit + fi + echo "RELEASE_TYPE=no-release" >> $GITHUB_ENV + echo "not release" - name: build env: RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}" diff --git a/scripts/run-like-github-actions.sh b/scripts/run-like-github-actions.sh index a0bb956c..144100eb 100755 --- a/scripts/run-like-github-actions.sh +++ b/scripts/run-like-github-actions.sh @@ -92,6 +92,14 @@ function alb-gh-release-alb() ( local version=$(alb-github-gen-version) docker image inspect $IMAGE_REPO/alb:$version docker push $IMAGE_REPO/alb:$version + git fetch --all # https://github.com/JamesIves/github-pages-deploy-action/issues/74 + # yes. we allow to re-release + git tag --delete alauda-alb2-$version || true + git push origin --delete alauda-alb2-$version || true + git tag alauda-alb2-$version + git push origin alauda-alb2-$version + git tag | cat + gh release delete alauda-alb2-$version || true .github/cr.sh --owner "alauda" --repo "alb" --charts-dir "./deploy/chart/alb" --skip-packaging "true" --pages-branch "gh-pages" fi return @@ -145,8 +153,7 @@ function alb-gh-get-gobuild-ver() ( ) function alb-github-gen-version() { - local branch=$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | sed 's|/|-|g') - if [[ "$branch" == "master" ]]; then + if [[ "$RELEASE_TYPE" == "release" ]]; then echo v$CURRENT_VERSION return fi