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
25 changes: 25 additions & 0 deletions .github/scripts/check-version-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail

SNAP_VERSION="$(sed -n 's/^version:[[:space:]]*\(.*\)$/\1/p' snap/snapcraft.yaml | head -n1 | tr -d '"' | xargs)"
GO_VERSION="$(sed -n 's/^var version = "\([^"]*\)"$/\1/p' aproxy.go | head -n1)"

if [[ -z "$SNAP_VERSION" ]]; then
echo "Could not parse version from snap/snapcraft.yaml"
exit 1
fi

if [[ -z "$GO_VERSION" ]]; then
echo "Could not parse version from aproxy.go"
exit 1
fi

if [[ "$SNAP_VERSION" != "$GO_VERSION" ]]; then
echo "Version mismatch detected"
echo "snap/snapcraft.yaml version: $SNAP_VERSION"
echo "aproxy.go version: $GO_VERSION"
echo "Keep both versions synchronized before merging or releasing."
exit 1
fi

echo "Version check passed: $GO_VERSION"
20 changes: 14 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ name: Release

on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v1.0.0)'
required: true
type: string

permissions:
contents: write
Expand All @@ -24,10 +19,23 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Validate Version Sync
run: |
bash .github/scripts/check-version-sync.sh

- name: Create tag
id: tag
run: |
TAG="${{ inputs.tag }}"
GO_VERSION="$(sed -n 's/^var version = "\([^"]*\)"$/\1/p' aproxy.go | head -n1)"
if [[ -z "$GO_VERSION" ]]; then
echo "Could not parse version from aproxy.go"
exit 1
fi
TAG="v${GO_VERSION}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists. Please bump the version in aproxy.go and snap/snapcraft.yaml before releasing."
exit 1
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
go fmt ./...
git diff --exit-code

- name: Check Version Sync
run: |
bash .github/scripts/check-version-sync.sh

- name: Build and Test
run: |
go test -race ./...
2 changes: 1 addition & 1 deletion aproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"golang.org/x/crypto/cryptobyte"
)

var version = "0.2.4"
var version = "0.2.5"

// PrereadConn is a wrapper around net.Conn that supports pre-reading from the underlying connection.
// Any Read before the EndPreread can be undone and read again by calling the EndPreread function.
Expand Down
Loading