Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
uses: actions/checkout@v6

- name: Test
uses: ./.github/actions/test
uses: ./.github/actions/test
20 changes: 19 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,22 @@ jobs:
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
WINGET_GITHUB_TOKEN: ${{ secrets.WINGET_GITHUB_TOKEN }}

- name: Publish Linux packages to Cloudsmith
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: |
shopt -s nullglob
pip install --upgrade cloudsmith-cli
for pkg in dist/*.deb; do
cloudsmith push deb borisdvlpr/gotail/any-distro/any-version "$pkg"
done
for pkg in dist/*.rpm; do
cloudsmith push rpm borisdvlpr/gotail/any-distro/any-version "$pkg"
done
for pkg in dist/*.apk; do
cloudsmith push alpine borisdvlpr/gotail/alpine/any-version "$pkg"
done
42 changes: 41 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ builds:
- arm
- arm64
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
- -s -w -X github.com/borisdvlpr/gotail/cmd.version={{.Version}}

archives:
- formats: [tar.gz]
Expand Down Expand Up @@ -55,6 +55,46 @@ nfpms:
- rpm
- archlinux

brews:
- repository:
owner: borisdvlpr
name: homebrew-gotail
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
directory: Formula
homepage: https://github.com/borisdvlpr/gotail
description: "Bootstrap Tailscale into your Raspberry Pi from the very first boot."
license: BSD-3-Clause
test: |
system "#{bin}/gotail --version"
install: |
bin.install "gotail"

winget:
- name: gotail
package_identifier: borisdvlpr.gotail
publisher: borisdvlpr
license: BSD-3-Clause
copyright: "Eduardo Miranda"
homepage: https://github.com/borisdvlpr/gotail
short_description: "Bootstrap Tailscale into your Raspberry Pi from the very first boot."
description: |-
Bootstrap Tailscale into your Raspberry Pi and join it to your
tailnet automatically from the very first boot.
publisher_url: https://github.com/borisdvlpr
publisher_support_url: https://github.com/borisdvlpr/gotail/issues
repository:
owner: borisdvlpr
name: winget-pkgs
branch: "gotail-{{.Version}}"
token: "{{ .Env.WINGET_GITHUB_TOKEN }}"
pull_request:
enabled: true
draft: true
base:
owner: microsoft
name: winget-pkgs
branch: master

changelog:
sort: asc
filters:
Expand Down
102 changes: 27 additions & 75 deletions taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,111 +5,63 @@ silent: true
vars:
MAIN_PATH: .
BINARY_NAME: bin/gotail
VERSION: '{{.VERSION | default "$(cat version.txt)"}}-snapshot'
EXE: '{{if eq OS "windows"}}.exe{{end}}'
VERSION:
sh: cat version.txt

tasks:
check-go:
desc: Check if Go is installed
desc: Verify that Go is installed
cmds:
- echo "Checking Go..."
- |
if ! command -v go >/dev/null 2>&1; then
echo "Error: Go is not installed. Please install Go before proceeding."
exit 1
else
echo "Go version $(go version | awk '{print substr($3, 3)}') is installed at $(which go)."
fi
echo "Using $(go version)."

test:
desc: Run all tests
desc: Run unit tests
cmds:
- echo "Running unit tests..."
- go test ./... -v 2>&1 || (echo "Tests failed." && exit 1)
- go test ./... -v
- echo "Tests passed."

build:
desc: Build binary for current platform
desc: Build the binary for the current platform
deps: [check-go, test]
env:
CGO_ENABLED: "0"
cmds:
- task: build-{{OS}}-{{ARCH}}

build-darwin-arm64:
desc: Build binary for macOS ARM64
cmds:
- echo "Building macOS arm64 binary..."
- CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-X github.com/borisdvlpr/gotail/main.version={{.VERSION}}" -o {{.BINARY_NAME}}-macos-arm64 {{.MAIN_PATH}}
- echo "Build completed."

build-linux-amd64:
desc: Build binary for Linux AMD64
cmds:
- echo "Building linux amd64 binary..."
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/borisdvlpr/gotail/main.version={{.VERSION}}" -o {{.BINARY_NAME}}-linux-amd64 {{.MAIN_PATH}}
- echo "Build completed."

build-linux-arm64:
desc: Build binary for Linux ARM64
cmds:
- echo "Building linux arm64 binary..."
- CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-X github.com/borisdvlpr/gotail/main.version={{.VERSION}}" -o {{.BINARY_NAME}}-linux-arm64 {{.MAIN_PATH}}
- echo "Build completed."

build-windows-amd64:
desc: Build binary for Windows AMD64
cmds:
- echo "Building windows amd64 binary..."
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/borisdvlpr/gotail/main.version={{.VERSION}}" -o {{.BINARY_NAME}}-windows-amd64.exe {{.MAIN_PATH}}
- echo "Building gotail for {{OS}}/{{ARCH}}..."
- go build -ldflags "-X github.com/borisdvlpr/gotail/cmd.version={{.VERSION}}-snapshot" -o {{.BINARY_NAME}}{{.EXE}} {{.MAIN_PATH}}
- echo "Build completed."

install:
desc: Install binary to local path
desc: Install the binary into your user bin directory
deps: [build]
cmds:
- |
if [ "{{OS}}" = "windows" ]; then
echo "Installing gotail on $USERPROFILE/AppData/Local/Microsoft/WindowsApps..."
- cmd: |
mkdir -p "$USERPROFILE/AppData/Local/Microsoft/WindowsApps"
cp {{.BINARY_NAME}}-windows-amd64.exe "$USERPROFILE/AppData/Local/Microsoft/WindowsApps/gotail.exe"

elif [ "{{OS}}" = "linux" ]; then
echo "Installing gotail on $HOME/.local/bin..."
mkdir -p $HOME/.local/bin
if [ "{{ARCH}}" = "amd64" ]; then
cp {{.BINARY_NAME}}-linux-amd64 $HOME/.local/bin/gotail
elif [ "{{ARCH}}" = "arm64" ]; then
cp {{.BINARY_NAME}}-linux-arm64 $HOME/.local/bin/gotail
else
echo "Unsupported Linux architecture: {{ARCH}}"
exit 1
fi
elif [ "{{OS}}" = "darwin" ]; then
echo "Installing gotail on $HOME/.local/bin..."
mkdir -p $HOME/.local/bin
if [ "{{ARCH}}" = "arm64" ]; then
cp {{.BINARY_NAME}}-macos-arm64 $HOME/.local/bin/gotail
else
echo "Unsupported macOS architecture: {{ARCH}}"
exit 1
fi
else
echo "Unsupported operating system: {{OS}}"
exit 1
fi
cp {{.BINARY_NAME}}.exe "$USERPROFILE/AppData/Local/Microsoft/WindowsApps/gotail.exe"
platforms: [windows]
- cmd: |
mkdir -p "$HOME/.local/bin"
cp {{.BINARY_NAME}} "$HOME/.local/bin/gotail"
platforms: [linux, darwin]
- echo "gotail installed successfully."

clean:
desc: Clean up build artifacts and local installation
desc: Remove build artifacts and the installed binary
cmds:
- echo "Cleaning local installation..."
- rm -rf bin/
- |
if [ "{{OS}}" = "windows" ]; then
rm -f "$USERPROFILE/AppData/Local/Microsoft/WindowsApps/gotail.exe"
else
rm -f $HOME/.local/bin/gotail
fi
- cmd: rm -f "$USERPROFILE/AppData/Local/Microsoft/WindowsApps/gotail.exe"
platforms: [windows]
- cmd: rm -f "$HOME/.local/bin/gotail"
platforms: [linux, darwin]
- echo "Cleaned up."

all:
desc: Build and install the application
desc: Build, test, and install gotail
cmds:
- task: install
Loading