-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from FOSS-Community/feat/releasev1
feat: prepare for v1 release
- Loading branch information
Showing
5 changed files
with
108 additions
and
68 deletions.
There are no files selected for viewing
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
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 }} |
This file was deleted.
Oops, something went wrong.
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
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" |
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
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." |
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