add command make version to in Makefile (#2579)

This commit is contained in:
HaiLaz
2023-04-14 10:09:19 +08:00
committed by GitHub
parent 32a7f6a0f0
commit fdc027734c
2 changed files with 12 additions and 16 deletions

View File

@ -19,18 +19,6 @@ jobs:
- name: Checkout Github Code
uses: actions/checkout@v3
# - name: Update Dependencies
# run: make gftidy
#
# - name: Commit & Push Changes
# uses: actions-js/push@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: master
# author_name: TagRobot
# author_email: tagrobot@goframe.org
# message: "auto update version to ${{ github.ref_name }}"
- name: Auto Creating Tags For Contrib Packages
run: |
git config --global user.email "tagrobot@goframe.org"

View File

@ -15,12 +15,20 @@ tidy:
lint:
golangci-lint run
gftidy:
# make version to=v2.4.0
version:
$(eval files=$(shell find . -name go.mod))
@set -e; \
# GITHUB_REF_NAME=v2.4.0; \
if [[ $$GITHUB_REF_NAME =~ "v" ]]; then \
latestVersion=$$GITHUB_REF_NAME; \
newVersion=$(to); \
echo "The version will be set to $$newVersion"; \
if [[ $$newVersion =~ "v" ]]; then \
latestVersion=$$newVersion; \
echo "package gf" > version.go; \
echo "" >> version.go; \
echo "const (" >> version.go; \
echo -e "\t// VERSION is the current GoFrame version." >> version.go; \
echo -e "\tVERSION = \"$$latestVersion\"" >> version.go; \
echo ")" >> version.go; \
else \
latestVersion=latest; \
fi; \