A Transparent and Verifiable Way to Sync the AT Protocol's PLC Directory
1#!/bin/bash
2
3set -e
4
5# Colors
6RED='\033[0;31m'
7GREEN='\033[0;32m'
8YELLOW='\033[1;33m'
9NC='\033[0m'
10
11# Get latest tag
12LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
13
14if [[ -z "$LATEST_TAG" ]]; then
15 echo -e "${RED}Error: No tags found${NC}"
16 echo "Create a tag first using: make bump-patch|bump-minor|bump-major"
17 exit 1
18fi
19
20echo -e "${GREEN}Releasing version: ${LATEST_TAG}${NC}"
21echo ""
22
23# Check if tag is already pushed
24if git ls-remote --tags origin | grep -q "${LATEST_TAG}"; then
25 echo -e "${YELLOW}Warning: Tag ${LATEST_TAG} already exists on remote${NC}"
26 read -p "Continue anyway? (y/N) " -n 1 -r
27 echo
28 if [[ ! $REPLY =~ ^[Yy]$ ]]; then
29 exit 0
30 fi
31fi
32
33# Push tag
34echo "Pushing tag ${LATEST_TAG}..."
35git push origin "${LATEST_TAG}"
36
37# Also push main/master branch
38BRANCH=$(git rev-parse --abbrev-ref HEAD)
39echo "Pushing branch ${BRANCH}..."
40git push origin "${BRANCH}"
41
42echo ""
43echo -e "${GREEN}✓ Release ${LATEST_TAG} published${NC}"
44echo ""
45echo "View releases at:"
46echo " https://tangled.org/@atscan.net/plcbundle/tags"