From fd81ac8f0eb3b7a8d0cde915067a22aabeecbdf8 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Tue, 17 May 2022 17:39:04 +0800 Subject: [PATCH] fix release version --- .github/workflows/release.yml | 13 ++++++++----- helper/.goreleaser.yml | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index baa6845..c7d925f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,12 @@ jobs: name: Release on GitHub runs-on: ubuntu-latest steps: + - name: Get Release Version + run: | + export RELEASE_VERSION=${GITHUB_REF#refs/*/} + echo RELEASE_VERSION: ${RELEASE_VERSION} + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV + - name: Check out code uses: actions/checkout@v3 @@ -25,7 +31,7 @@ jobs: cd admin npm install -g yarn yarn - VITE_ADMIN_VERSION=${GITHUB_REF#refs/*/} yarn build + VITE_ADMIN_VERSION=${{ env.RELEASE_VERSION }} yarn build echo "${{secrets.DEPLOY_KEY}}" > deploy_key chmod 600 ./deploy_key tar -cvzf dist.tar.gz dist @@ -47,7 +53,7 @@ jobs: env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Docker meta + - name: Create Docker id: meta uses: docker/metadata-action@v3 with: @@ -71,9 +77,6 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Get Release Version - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Build and push uses: docker/build-push-action@v2 with: diff --git a/helper/.goreleaser.yml b/helper/.goreleaser.yml index 83e0158..02e6060 100644 --- a/helper/.goreleaser.yml +++ b/helper/.goreleaser.yml @@ -12,9 +12,9 @@ builds: dir: . main: main.go ldflags: - - -s -w -X main.Version={{.Version}} + - -s -w -X main.Version=v{{.Version}} - id: dtm_arm64 - env: [ CGO_ENABLED=0 ] + env: [CGO_ENABLED=0] goos: - darwin goarch: @@ -22,4 +22,4 @@ builds: dir: . main: main.go ldflags: - - -s -w -X main.Version={{.Version}} + - -s -w -X main.Version=v{{.Version}}