Merge pull request #2 from tejastn10/feature/scripts #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Workflow | |
on: | |
push: | |
tags: | |
- "v*.*.*" # Trigger the workflow when a version tag is pushed | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build and Release | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Fetch all tags | |
- name: Fetch Tags | |
run: git fetch --force --tags | |
# Setup Go environment | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
# Build the binary for multiple platforms | |
- name: Build Binary | |
run: | | |
mkdir -p dist | |
GOOS=linux GOARCH=amd64 go build -o dist/halcyon-linux-amd64 main.go | |
GOOS=darwin GOARCH=arm64 go build -o dist/halcyon-darwin-arm64 main.go | |
GOOS=windows GOARCH=amd64 go build -o dist/halcyon-windows-amd64.exe main.go | |
# Compress the binaries | |
- name: Compress Binaries | |
run: | | |
cd dist | |
zip halcyon-linux-amd64.zip halcyon-linux-amd64 | |
zip halcyon-darwin-arm64.zip halcyon-darwin-arm64 | |
zip halcyon-windows-amd64.zip halcyon-windows-amd64.exe | |
# Create GitHub Release | |
- name: Generate Release Notes | |
id: release-notes | |
run: | | |
echo "# Halcyon ${{ github.ref_name }} 🚀" >> release-notes.md | |
echo "" >> release-notes.md | |
echo "## ✨ Features" >> release-notes.md | |
echo "" >> release-notes.md | |
echo "---" >> release-notes.md | |
echo "" >> release-notes.md | |
echo "## 🛠 Installation" >> release-notes.md | |
echo "" >> release-notes.md | |
echo "For macOS, Linux, and Windows:" >> release-notes.md | |
echo "1. Download the latest release binary from the [Releases](https://github.com/tejastn10/halcyon/releases) page." >> release-notes.md | |
echo "2. Extract the binary and add it to your system’s PATH." >> release-notes.md | |
echo "" >> release-notes.md | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ github.ref_name }} | |
body_path: release-notes.md | |
draft: false | |
prerelease: false | |
files: dist/*.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
npm: | |
name: Publish to NPM | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 |