Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
chiefMarlin authored Sep 27, 2024
1 parent 7fd1ad2 commit 4ef9681
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ on:
push:
branches:
- main
workflow_dispatch:
inputs:
releaseNote:
description: 'Release Note'
required: false
default: 'Manual release'

env:
TAG: latest
RELEASE_NAME: Latest release
RELEASE_BODY: Latest release
BINARY_PREFIX: viterbiCli # Updated to match your new project name
BINARY_PREFIX: viterbiCli
BUILD_DIR: build

jobs:
build_and_release:
Expand All @@ -28,7 +34,7 @@ jobs:

- name: Build binaries
run: |
mkdir -p build
mkdir -p ${{ env.BUILD_DIR }}
PLATFORMS=(
"darwin/arm64"
"darwin/amd64"
Expand Down Expand Up @@ -58,9 +64,16 @@ jobs:
OUTPUT_NAME=$OUTPUT_NAME.exe
fi
echo "Building for $GOOS/$GOARCH..."
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "build/$OUTPUT_NAME" ./cmd/viterbiCli
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "${{ env.BUILD_DIR }}/$OUTPUT_NAME" ./cmd/viterbiCli
done
- name: Delete existing release
uses: dev-drprasad/[email protected]
with:
tag_name: ${{ env.TAG }}
delete_release: true
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -69,7 +82,7 @@ jobs:
with:
tag_name: ${{ env.TAG }}
release_name: ${{ env.RELEASE_NAME }}
body: ${{ env.RELEASE_BODY }}
body: ${{ github.event.inputs.releaseNote || 'Automated release' }}
draft: false
prerelease: false

Expand All @@ -82,7 +95,7 @@ jobs:
const path = require('path');
const uploadUrl = '${{ steps.create_release.outputs.upload_url }}';
const buildDir = 'build';
const buildDir = '${{ env.BUILD_DIR }}';
const files = await fs.readdir(buildDir);
for (const file of files) {
Expand Down

0 comments on commit 4ef9681

Please sign in to comment.