Skip to content

Commit

Permalink
Added release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony V. Ozdemir committed May 31, 2023
1 parent e29e07e commit 74bbbf6
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# .github/workflows/release.yml
name: release

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18

- name: Check out code
uses: actions/checkout@v3

- name: Set up golanci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest

- name: Run Tests
run: make test

- name: Build release
run: make release

- name: Set version
run: echo "NUMERIC_VERSION=$(echo ${GITHUB_REF#refs/*/v})" >> $GITHUB_ENV

- name: Rename files
run: |
mv build/zfse-linux-amd64 build/zfse-${{ env.NUMERIC_VERSION }}-linux-amd64
mv build/zfse-windows-amd64.exe build/zfse-${{ env.NUMERIC_VERSION }}-windows-amd64.exe
mv build/zfse-darwin-amd64 build/zfse-${{ env.NUMERIC_VERSION }}-darwin-amd64
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
draft: true
name: v${{ env.NUMERIC_VERSION }}
files: |
build/zfse-${{ env.NUMERIC_VERSION }}-linux-amd64
build/zfse-${{ env.NUMERIC_VERSION }}-windows-amd64.exe
build/zfse-${{ env.NUMERIC_VERSION }}-darwin-amd64
env:
GITHUB_TOKEN: ${{ secrets.ACTION_GH_RELEASE_SECRET }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build:

release:
GOARCH=amd64 GOOS=linux go build -o ${BUILD_OUTPUT_PREFIX_DIR}${BUILD_OUTPUT_BASE_NAME}-linux-amd64 ./cmd/main.go
GOARCH=amd64 GOOS=windows go build -o ${BUILD_OUTPUT_PREFIX_DIR}${BUILD_OUTPUT_BASE_NAME}-windows-amd64 ./cmd/main.go
GOARCH=amd64 GOOS=windows go build -o ${BUILD_OUTPUT_PREFIX_DIR}${BUILD_OUTPUT_BASE_NAME}-windows-amd64.exe ./cmd/main.go
GOARCH=amd64 GOOS=darwin go build -o ${BUILD_OUTPUT_PREFIX_DIR}${BUILD_OUTPUT_BASE_NAME}-darwin-amd64 ./cmd/main.go

clean:
Expand Down

0 comments on commit 74bbbf6

Please sign in to comment.