From 40959aa74c152bff7912994dfd265862bf11c998 Mon Sep 17 00:00:00 2001 From: ZhouYixun <291028775@qq.com> Date: Wed, 7 Sep 2022 01:46:05 +0800 Subject: [PATCH] feat: version check --- .github/workflows/release.yml | 18 ++++++++++++++++++ .github/workflows/test.yml | 35 ----------------------------------- 2 files changed, 18 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55d8c78..399cd0d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,11 +14,29 @@ jobs: with: fetch-depth: 0 + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.18 + - name: Build + run: go build -o sib + + - name: run + id: ver + run: echo "::set-output name=version::$(./sib version)" + + - name: compare + if: ${{ env.VERSION != env.TAG }} + run: exit 1 + env: + VERSION: v${{ steps.ver.outputs.version }} + TAG: ${{ steps.previoustag.outputs.tag }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index d133137..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: test - -on: - workflow_dispatch: - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: 'Get Previous tag' - id: previoustag - uses: "WyriHaximus/github-action-get-previous-tag@v1" - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Build - run: go build -o sib - - - name: run - id: ver - run: echo "::set-output name=version::$(./sib version)" - - - name: compare - if: ${{ env.VERSION != env.TAG }} - run: exit 1 - env: - VERSION: ${{ steps.ver.outputs.version }} - TAG: ${{ steps.previoustag.outputs.tag }}