Skip to content

Commit e52a04f

Browse files
authored
Merge pull request #7 from 0xjuanma/golaze-release
feat[release]: golazo release workflow integration and install updates
2 parents 8978e02 + d363aba commit e52a04f

File tree

5 files changed

+172
-33
lines changed

5 files changed

+172
-33
lines changed

.github/workflows/build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
tags: ['v*.*.*']
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
include:
16+
- goos: darwin
17+
goarch: amd64
18+
- goos: darwin
19+
goarch: arm64
20+
- goos: linux
21+
goarch: amd64
22+
- goos: linux
23+
goarch: arm64
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: '1.23'
32+
33+
- name: Build binary
34+
env:
35+
GOOS: ${{ matrix.goos }}
36+
GOARCH: ${{ matrix.goarch }}
37+
run: |
38+
go build -ldflags="-s -w" -o golazo-${{ matrix.goos }}-${{ matrix.goarch }} .
39+
40+
- name: Upload artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: golazo-${{ matrix.goos }}-${{ matrix.goarch }}
44+
path: golazo-${{ matrix.goos }}-${{ matrix.goarch }}
45+
46+
release:
47+
needs: build
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Download all artifacts
53+
uses: actions/download-artifact@v4
54+
with:
55+
path: dist
56+
merge-multiple: true
57+
58+
- name: Upload binaries to release
59+
uses: softprops/action-gh-release@v2
60+
with:
61+
files: dist/*
62+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Post-Release Changelog Update
2+
3+
on:
4+
repository_dispatch:
5+
types: [release-published]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
update-changelog:
13+
# Use @main for newest version, or pin to specific version like @v1.0.0
14+
uses: 0xjuanma/simple-release/.github/workflows/reusable-post-release-changelog.yml@main
15+
secrets:
16+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*.*.*']
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
# Use @main for newest version, or pin to specific version like @v1.0.0
13+
uses: 0xjuanma/simple-release/.github/workflows/reusable-release.yml@main
14+
with:
15+
changelog-path: 'CHANGELOG.md'
16+
secrets:
17+
RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Initial public release
12+
- Live match tracking with real-time updates
13+
- Match details view with events and statistics
14+
- Several major footbal leagues supported
15+
- Beautiful TUI with neon-styled interface
16+
- FotMob API integration for match data
17+
- Cross-platform support (macOS, Linux)
18+

scripts/install.sh

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ ASCII_LOGO=" ________ .__
3232
\______ /\____/|____(____ /_____ \____/
3333
\/ \/ \/ "
3434

35-
# Get the latest release tag or use main
36-
VERSION=${1:-main}
3735
REPO="0xjuanma/golazo"
3836
BINARY_NAME="golazo"
37+
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
3938

4039
# Print ASCII art header with cyan color
4140
printf "${BRIGHT_CYAN}${ASCII_LOGO}${NC}\n\n"
@@ -45,48 +44,73 @@ printf "${BRIGHT_GREEN}Installing ${BINARY_NAME}...${NC}\n\n"
4544
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
4645
ARCH=$(uname -m)
4746

48-
case $ARCH in
47+
case "$ARCH" in
4948
x86_64) ARCH="amd64" ;;
50-
arm64|aarch64) ARCH="arm64" ;;
49+
aarch64|arm64) ARCH="arm64" ;;
5150
*) printf "${BRIGHT_RED}Unsupported architecture: ${ARCH}${NC}\n"; exit 1 ;;
5251
esac
5352

54-
# Create temp directory
55-
TMP_DIR=$(mktemp -d)
56-
trap "rm -rf ${TMP_DIR}" EXIT
53+
# Check for supported OS
54+
case "$OS" in
55+
darwin|linux) ;;
56+
*) printf "${BRIGHT_RED}Unsupported operating system: ${OS}${NC}\n"; exit 1 ;;
57+
esac
5758

58-
# Clone repository
59-
printf "${CYAN}Cloning repository...${NC}\n"
60-
git clone --depth 1 --branch ${VERSION} https://github.com/${REPO}.git ${TMP_DIR}/golazo 2>/dev/null || \
61-
git clone --depth 1 https://github.com/${REPO}.git ${TMP_DIR}/golazo
59+
printf "${CYAN}Detected: ${OS}/${ARCH}${NC}\n"
6260

63-
cd ${TMP_DIR}/golazo
61+
# Get the latest release tag
62+
printf "${CYAN}Fetching latest release...${NC}\n"
63+
LATEST=$(curl -sL "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | cut -d'"' -f4)
6464

65-
# Build the binary
66-
printf "${CYAN}Building ${BINARY_NAME}...${NC}\n"
67-
go build -o ${BINARY_NAME} .
65+
if [ -z "$LATEST" ]; then
66+
printf "${BRIGHT_RED}Failed to fetch latest release${NC}\n"
67+
exit 1
68+
fi
6869

69-
# Determine install location
70-
if [ -w /usr/local/bin ]; then
71-
INSTALL_DIR="/usr/local/bin"
72-
elif [ -w ~/.local/bin ]; then
73-
INSTALL_DIR="$HOME/.local/bin"
74-
mkdir -p ${INSTALL_DIR}
75-
else
76-
INSTALL_DIR="$HOME/bin"
77-
mkdir -p ${INSTALL_DIR}
70+
printf "${CYAN}Latest version: ${LATEST}${NC}\n"
71+
72+
# Construct download URL
73+
URL="https://github.com/$REPO/releases/download/$LATEST/${BINARY_NAME}-${OS}-${ARCH}"
74+
75+
# Download the binary
76+
printf "${CYAN}Downloading ${BINARY_NAME} ${LATEST} for ${OS}/${ARCH}...${NC}\n"
77+
if ! curl -sL "$URL" -o "$BINARY_NAME"; then
78+
printf "${BRIGHT_RED}Failed to download binary${NC}\n"
79+
exit 1
7880
fi
7981

80-
# Install the binary
82+
chmod +x "$BINARY_NAME"
83+
84+
# Determine install location and install
8185
printf "${CYAN}Installing to ${INSTALL_DIR}...${NC}\n"
82-
cp ${BINARY_NAME} ${INSTALL_DIR}/${BINARY_NAME}
83-
chmod +x ${INSTALL_DIR}/${BINARY_NAME}
8486

85-
# Check if the binary is in PATH
86-
if ! command -v ${BINARY_NAME} >/dev/null 2>&1; then
87-
printf "${YELLOW}Warning: ${BINARY_NAME} may not be in your PATH.${NC}\n"
88-
printf "${YELLOW}Add ${INSTALL_DIR} to your PATH if needed.${NC}\n"
87+
if [ -w "$INSTALL_DIR" ]; then
88+
mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
89+
else
90+
# Try with sudo if we don't have write access
91+
if command -v sudo >/dev/null 2>&1; then
92+
sudo mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
93+
else
94+
# Fallback to user's local bin
95+
INSTALL_DIR="$HOME/.local/bin"
96+
mkdir -p "$INSTALL_DIR"
97+
mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
98+
printf "${YELLOW}Installed to ${INSTALL_DIR} (no sudo available)${NC}\n"
99+
fi
89100
fi
90101

91-
printf "\n${BRIGHT_GREEN}${BINARY_NAME} installed successfully!${NC}\n"
92-
printf "${BRIGHT_GREEN}Run '${BINARY_NAME}' to start.${NC}\n"
102+
# Verify installation
103+
if [ -f "$INSTALL_DIR/$BINARY_NAME" ]; then
104+
# Check if the binary is in PATH
105+
if ! command -v "$BINARY_NAME" >/dev/null 2>&1; then
106+
printf "\n${YELLOW}Warning: ${BINARY_NAME} may not be in your PATH.${NC}\n"
107+
printf "${YELLOW}Add ${INSTALL_DIR} to your PATH if needed:${NC}\n"
108+
printf "${CYAN} export PATH=\"\$PATH:${INSTALL_DIR}\"${NC}\n"
109+
fi
110+
111+
printf "\n${BRIGHT_GREEN}${BINARY_NAME} ${LATEST} installed successfully!${NC}\n"
112+
printf "${BRIGHT_GREEN}Run '${BINARY_NAME}' to start watching live football matches.${NC}\n"
113+
else
114+
printf "${BRIGHT_RED}Installation failed${NC}\n"
115+
exit 1
116+
fi

0 commit comments

Comments
 (0)