From 471881f680aa848720d9a600ac422e65b79f2404 Mon Sep 17 00:00:00 2001 From: Matthias <5011972+fasmat@users.noreply.github.com> Date: Wed, 5 Jul 2023 18:41:32 +0000 Subject: [PATCH] Clean up release to not need version.txt --- .github/workflows/release.yml | 22 ++++++++-------------- Makefile | 13 +------------ 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05121665f7..68a74b6d80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,12 +54,12 @@ jobs: if: ${{ contains(matrix.os, 'macos') && runner.arch == 'arm64' }} run: echo "SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk" >> $GITHUB_ENV - # `make build` reads version from version.txt but in Windows it doesn't work therefore passing version explicitly - name: Build go-spacemesh shell: bash run: | make install make build VERSION=${{ github.ref }} BIN_DIR_WIN=./build + - name: Create release archive shell: bash env: @@ -80,7 +80,7 @@ jobs: uses: google-github-actions/upload-cloud-storage@v0 with: path: ${{ env.OUTNAME }}.zip - destination: ${{ secrets.GCP_BUCKET }}/${{ steps.version.outputs.content }}/ + destination: ${{ secrets.GCP_BUCKET }}/${{ github.ref }}/ release: runs-on: ubuntu-latest @@ -89,12 +89,6 @@ jobs: - name: Check out Git repository uses: actions/checkout@v3 - - name: Read version.txt - id: version - uses: juliangruber/read-file-action@v1 - with: - path: ./version.txt - - name: Create Release uses: actions/create-release@v1 id: create_release @@ -102,13 +96,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} - release_name: Release ${{ steps.version.outputs.content }} + release_name: Release ${{ github.ref }} body: | ## Zip Files - - Windows: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ steps.version.outputs.content }}/Windows.zip - - macOS: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ steps.version.outputs.content }}/macOS.zip - - macOS arm64: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ steps.version.outputs.content }}/macOS_ARM64.zip - - Linux: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ steps.version.outputs.content }}/Linux.zip - - Linux arm64: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ steps.version.outputs.content }}/Linux_ARM64.zip + - Windows: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ github.ref }}/Windows.zip + - macOS: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ github.ref }}/macOS.zip + - macOS arm64: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ github.ref }}/macOS_ARM64.zip + - Linux: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ github.ref }}/Linux.zip + - Linux arm64: https://storage.googleapis.com/${{ secrets.GCP_BUCKET }}/${{ github.ref }}/Linux_ARM64.zip draft: false prerelease: true diff --git a/Makefile b/Makefile index 71dfbfafba..86020868cd 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +VERSION ?= $(shell git describe --tags) LDFLAGS = -ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.branch=${BRANCH}" include Makefile-libs.Inc @@ -11,16 +12,6 @@ BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) export CGO_ENABLED := 1 export CGO_CFLAGS := $(CGO_CFLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1 -# These commands cause problems on Windows -ifeq ($(OS),Windows_NT) - # Just assume we're in interactive mode on Windows - INTERACTIVE = 1 - VERSION ?= $(shell type version.txt) -else - INTERACTIVE := $(shell [ -t 0 ] && echo 1) - VERSION ?= $(shell cat version.txt) -endif - # Add an indicator to the branch name if dirty and use commithash if running in detached mode ifeq ($(BRANCH),HEAD) BRANCH = $(SHA) @@ -151,8 +142,6 @@ cover: get-libs tag-and-build: git diff --quiet || (echo "\033[0;31mWorking directory not clean!\033[0m" && git --no-pager diff && exit 1) - printf "${VERSION}" > version.txt - git commit -m "bump version to ${VERSION}" version.txt git tag ${VERSION} git push origin ${VERSION} DOCKER_BUILDKIT=1 docker build -t go-spacemesh:${VERSION} .