Skip to content

Commit

Permalink
Merge pull request #8 from FOSS-Community/feat/releasev1
Browse files Browse the repository at this point in the history
feat: prepare for v1 release
  • Loading branch information
Mr-Sunglasses authored Jan 7, 2025
2 parents 63ee03e + 024b32f commit 9ad4495
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 68 deletions.
46 changes: 25 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
name: build

on:
push:
branches:
- "**"
tags:
- "*"

name: Build
env:
GO_VERSION: 1.23
permissions:
contents: write

jobs:
build:
name: Run checks and build
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
- name: Checkout
uses: actions/checkout@v4
with:
go-version: ${{env.GO_VERSION}}

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}

- run: go fmt ./...
go-version: stable
# More assembly might be required: Docker logins, GPG, etc.
# It all depends on your needs.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
47 changes: 0 additions & 47 deletions .github/workflows/release.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
project_name: "ginister"

before:
hooks:
- go mod tidy
- go mod download

builds:
- main: ./main.go
binary: ginister
goos:
- linux
- darwin
goarm:
- "7"
58 changes: 58 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env sh

set -e

# Determine OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)

case $ARCH in
x86_64)
ARCH="amd64"
;;
aarch64|arm64)
ARCH="arm64"
;;
i386|i686)
ARCH="386"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac

# Check for version argument
# Otherwise, set latest release version
if [ -z "$VERSION" ]; then
VERSION=$(curl -s "https://api.github.com/repos/fOSS-Community/ginister/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([0-9.]+)".*/\1/')
fi

# Construct download URL
DOWNLOAD_URL="https://github.com/fOSS-Community/ginister/releases/download/v${VERSION}/ginister_${VERSION}_${OS}_${ARCH}.tar.gz"

# Create temporary directory
TMP_DIR=$(mktemp -d)
trap 'rm -rf "$TMP_DIR"' EXIT

# Download and extract
echo "Downloading ginister ${VERSION} for ${OS} ${ARCH}..."
curl -L -s "$DOWNLOAD_URL" | tar -xz -C "$TMP_DIR"

# Check if directory is writable by the current user
# If not, use sudo to install
INSTALL_DIR=${INSTALL_DIR:-/usr/local/bin}
if [ ! -w "$INSTALL_DIR" ]; then
echo "Installing ginister to $INSTALL_DIR..."
sudo mkdir -p "$INSTALL_DIR"
sudo mv "$TMP_DIR/ginister" "$INSTALL_DIR/"
else
echo "Installing ginister to $INSTALL_DIR..."
mkdir -p "$INSTALL_DIR"
mv "$TMP_DIR/ginister" "$INSTALL_DIR/"
fi

echo "ginister ${VERSION} has been installed successfully!"
echo "Be sure that $INSTALL_DIR is in your PATH:"
printf "\n\texport PATH=\$PATH:%s\n\n" "$INSTALL_DIR"
echo "You can now use the 'ginister' command."
10 changes: 10 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ Ginister is a Go CLI tool that helps you quickly scaffold a fully functioning ba

## Installation

### How to install

```sh
curl -L https://fosscu.org/ginister/install.sh | sh
```

This will install ginister on your computer.

### Install Manually

Clone the repository and build the CLI tool:

```bash
Expand Down

0 comments on commit 9ad4495

Please sign in to comment.