Skip to content

Commit

Permalink
Clean up release to not need version.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Jul 5, 2023
1 parent f8bd113 commit 471881f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -89,26 +89,20 @@ 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
env:
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
13 changes: 1 addition & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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} .
Expand Down

0 comments on commit 471881f

Please sign in to comment.