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
38 changes: 38 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Go CI

on:
push:
branches:
- '**'
pull_request:

permissions:
contents: read

jobs:
test:
name: Go ${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ['1.22', '1.23', '1.24', '1.25', '1.26', '1.27']

steps:
- name: Check out code
uses: actions/checkout@v7

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: ${{ matrix.go-version }}
cache: true

- name: Show Go version
run: go version

- name: Download dependencies
run: go mod download

- name: Run tests
run: go test ./...
71 changes: 71 additions & 0 deletions .github/workflows/publish-on-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Publish Go module

on:
pull_request:
types: [closed]
branches:
- main
workflow_dispatch:

permissions:
contents: write

jobs:
publish:
if: >
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
github.event.pull_request.merged == true)
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: '1.27'
cache: true

- name: Run tests
run: go test ./...

- name: Determine next version
id: version
shell: bash
run: |
set -euo pipefail
git fetch --tags --force

latest=$(git tag --sort=-v:refname | head -n 1 || true)

if [ -z "$latest" ]; then
next="v0.0.1"
else
version="${latest#v}"
IFS='.' read -r major minor patch <<< "$version"
patch=$((patch + 1))
next="v${major}.${minor}.${patch}"
fi

echo "next_version=$next" >> "$GITHUB_OUTPUT"

- name: Create Git tag and GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXT_VERSION: ${{ steps.version.outputs.next_version }}
shell: bash
run: |
set -euo pipefail

if git rev-parse "$NEXT_VERSION" >/dev/null 2>&1; then
echo "Tag $NEXT_VERSION already exists. Skipping release."
exit 0
fi

git tag "$NEXT_VERSION"
git push origin "$NEXT_VERSION"
gh release create "$NEXT_VERSION" --generate-notes --verify-tag
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
.idea/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 b0r1ssh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading