tangled
alpha
login
or
join now
atscan.net
/
plcbundle
A Transparent and Verifiable Way to Sync the AT Protocol's PLC Directory
14
fork
atom
overview
issues
2
pulls
pipelines
playing with spindle
tree.fail
3 months ago
58839e70
a4e771da
0/1
build.yml
failed
3mo ago
+190
-33
6 changed files
expand all
collapse all
unified
split
.gitignore
.goreleaser.yml
.tangled
workflows
build.yml
release.yml
Dockerfile.goreleaser
Makefile
+2
-1
.gitignore
···
1
.DS_Store
2
/plcbundle
3
-
plc_bundles.json
0
···
1
.DS_Store
2
/plcbundle
3
+
plc_bundles.json
4
+
dist
+36
.goreleaser.yml
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
version: 2
2
+
3
+
project_name: plcbundle
4
+
5
+
before:
6
+
hooks:
7
+
- go mod tidy
8
+
- go test ./...
9
+
10
+
builds:
11
+
- id: plcbundle
12
+
main: ./cmd/plcbundle
13
+
binary: plcbundle
14
+
env:
15
+
- CGO_ENABLED=1
16
+
# Only build for current platform locally
17
+
goos:
18
+
- darwin
19
+
goarch:
20
+
- arm64
21
+
ldflags:
22
+
- -s -w
23
+
- -X main.version={{.Version}}
24
+
- -X main.gitCommit={{.ShortCommit}}
25
+
- -X main.buildDate={{.Date}}
26
+
27
+
archives:
28
+
- formats: ["tar.gz"]
29
+
name_template: >-
30
+
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
31
+
32
+
checksum:
33
+
name_template: 'checksums.txt'
34
+
35
+
release:
36
+
disable: true
+33
.tangled/workflows/build.yml
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
# Build workflow - test compilation on pull requests
2
+
3
+
when:
4
+
- event: ["push", "pull_request"]
5
+
branch: ["main", "develop"]
6
+
7
+
engine: "nixery"
8
+
9
+
dependencies:
10
+
nixpkgs:
11
+
- go
12
+
- goreleaser
13
+
14
+
environment:
15
+
CGO_ENABLED: "0"
16
+
17
+
steps:
18
+
- name: "Download dependencies"
19
+
command: |
20
+
go mod download
21
+
go mod verify
22
+
23
+
- name: "Run tests"
24
+
command: |
25
+
go test -v ./...
26
+
27
+
- name: "Build snapshot (test cross-compilation)"
28
+
command: |
29
+
goreleaser build --snapshot --clean
30
+
31
+
- name: "Show artifacts"
32
+
command: |
33
+
ls -lh dist/
+37
.tangled/workflows/release.yml
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
when:
2
+
- event: ["manual"]
3
+
branch: ["main"]
4
+
5
+
engine: "nixery"
6
+
7
+
clone:
8
+
depth: 0
9
+
10
+
dependencies:
11
+
nixpkgs:
12
+
- go
13
+
- gcc
14
+
- gnumake
15
+
- zstd
16
+
- git
17
+
18
+
steps:
19
+
- name: "Build Linux binaries (native with CGO)"
20
+
command: |
21
+
# Build for current platform (Linux)
22
+
CGO_ENABLED=1 go build \
23
+
-ldflags="-s -w -X main.version=$(git describe --tags --always) -X main.gitCommit=$(git rev-parse --short HEAD)" \
24
+
-o dist/plcbundle_linux_amd64/plcbundle \
25
+
./cmd/plcbundle
26
+
27
+
echo "✓ Linux binary built:"
28
+
ls -lh dist/plcbundle_linux_amd64/plcbundle
29
+
30
+
- name: "Create archive"
31
+
command: |
32
+
cd dist
33
+
tar -czf plcbundle_$(git describe --tags)_linux_amd64.tar.gz plcbundle_linux_amd64/
34
+
sha256sum *.tar.gz > checksums.txt
35
+
36
+
echo "✓ Artifacts:"
37
+
ls -lh *.tar.gz checksums.txt
+19
Dockerfile.goreleaser
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
# syntax=docker/dockerfile:1
2
+
3
+
FROM alpine:3.19
4
+
5
+
RUN apk add --no-cache ca-certificates zstd-libs
6
+
7
+
RUN addgroup -g 1000 plcbundle && \
8
+
adduser -D -u 1000 -G plcbundle plcbundle && \
9
+
mkdir -p /data && \
10
+
chown plcbundle:plcbundle /data
11
+
12
+
# GoReleaser puts binaries in $TARGETPLATFORM/
13
+
ARG TARGETPLATFORM
14
+
COPY ${TARGETPLATFORM}/plcbundle /usr/local/bin/plcbundle
15
+
16
+
WORKDIR /data
17
+
USER plcbundle
18
+
19
+
ENTRYPOINT ["plcbundle"]
+63
-32
Makefile
···
1
-
.PHONY: all build install test clean fmt lint help version bump-patch bump-minor bump-major release
2
-
.PHONY: docker-build docker-push docker-run docker-clean docker-shell compose-up compose-down compose-logs
3
4
# Binary name
5
BINARY_NAME=plcbundle
···
8
# Docker configuration
9
DOCKER_IMAGE=plcbundle
10
DOCKER_TAG=$(VERSION)
11
-
DOCKER_REGISTRY=atscan
12
DOCKER_FULL_IMAGE=$(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,)$(DOCKER_IMAGE):$(DOCKER_TAG)
13
DOCKER_LATEST=$(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,)$(DOCKER_IMAGE):latest
0
14
15
# Version information
16
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
···
58
@echo "Cleaning..."
59
$(GOCLEAN)
60
rm -f $(BINARY_NAME)
0
61
62
# Format code
63
fmt:
···
96
@echo "Bumping major version..."
97
@./scripts/bump-version.sh major
98
99
-
# Create a release (tags and pushes)
0
0
0
0
0
0
100
release:
101
@echo "Creating release for version $(VERSION)..."
102
@./scripts/release.sh
103
-
@echo "Releasing docker image..."
104
-
@make docker-release
0
0
0
0
0
0
105
106
# ============================================================================
107
# Docker Commands
108
# ============================================================================
109
110
-
# Build Docker image
111
docker-build:
112
@echo "Building Docker image $(DOCKER_FULL_IMAGE)..."
113
docker build \
···
118
.
119
@echo "✓ Built: $(DOCKER_FULL_IMAGE)"
120
121
-
# Push Docker image to registry
0
0
0
0
0
0
0
0
0
0
0
0
0
122
docker-push:
123
@echo "Pushing Docker image..."
124
docker push $(DOCKER_FULL_IMAGE)
125
docker push $(DOCKER_LATEST)
126
@echo "✓ Pushed: $(DOCKER_FULL_IMAGE)"
127
128
-
# Build and push
129
-
docker-release: docker-build docker-push
130
-
131
# Run Docker container as CLI
132
docker-run:
133
-
docker run --rm -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) $(CMD)
0
0
0
0
134
135
-
# Run Docker container as server
0
0
0
0
0
0
136
docker-serve:
137
-
docker run --rm -it \
138
-
-p 8080:8080 \
139
-
-v $(PWD)/data:/data \
140
-
$(DOCKER_FULL_IMAGE) \
141
-
plcbundle serve --host 0.0.0.0
142
143
-
# Open shell in Docker container
144
docker-shell:
145
docker run --rm -it -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) sh
146
···
167
@echo " make test-coverage - Run tests with coverage"
168
@echo " make fmt - Format code"
169
@echo " make deps - Download dependencies"
170
-
@echo " make verify - Verify dependencies"
171
@echo ""
172
-
@echo "Versioning:"
173
@echo " make version - Show current version"
174
-
@echo " make bump-patch - Bump patch version (0.1.0 -> 0.1.1)"
175
-
@echo " make bump-minor - Bump minor version (0.1.0 -> 0.2.0)"
176
-
@echo " make bump-major - Bump major version (0.1.0 -> 1.0.0)"
177
-
@echo " make release - Create and push release tag"
0
0
0
178
@echo ""
179
@echo "Docker:"
180
-
@echo " make docker-build - Build Docker image"
181
-
@echo " make docker-push - Push image to registry"
182
-
@echo " make docker-release - Build and push"
183
-
@echo " make docker-run - Run as CLI (CMD='info')"
184
@echo " make docker-serve - Run as server"
185
-
@echo " make docker-shell - Open shell in container"
186
-
@echo " make docker-clean - Remove Docker images"
187
-
@echo ""
···
1
+
.PHONY: all build install test clean fmt lint help version bump-patch bump-minor bump-major release release-build
2
+
.PHONY: docker-build docker-buildx docker-push docker-run docker-clean docker-shell compose-up compose-down compose-logs
3
4
# Binary name
5
BINARY_NAME=plcbundle
···
8
# Docker configuration
9
DOCKER_IMAGE=plcbundle
10
DOCKER_TAG=$(VERSION)
11
+
DOCKER_REGISTRY?=atscan
12
DOCKER_FULL_IMAGE=$(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,)$(DOCKER_IMAGE):$(DOCKER_TAG)
13
DOCKER_LATEST=$(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,)$(DOCKER_IMAGE):latest
14
+
DOCKER_PLATFORMS?=linux/amd64,linux/arm64
15
16
# Version information
17
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
···
59
@echo "Cleaning..."
60
$(GOCLEAN)
61
rm -f $(BINARY_NAME)
62
+
rm -rf dist/
63
64
# Format code
65
fmt:
···
98
@echo "Bumping major version..."
99
@./scripts/bump-version.sh major
100
101
+
# Build release binaries with GoReleaser (local test)
102
+
release-build:
103
+
@echo "Building release binaries with GoReleaser..."
104
+
@goreleaser build --snapshot --clean
105
+
@echo "✓ Binaries built in dist/"
106
+
107
+
# Create release (runs your script + GoReleaser)
108
release:
109
@echo "Creating release for version $(VERSION)..."
110
@./scripts/release.sh
111
+
112
+
# Full release with binaries
113
+
release-full: release release-publish
114
+
115
+
# Publish release with GoReleaser
116
+
release-publish:
117
+
@echo "Publishing release with GoReleaser..."
118
+
@goreleaser release --clean
119
120
# ============================================================================
121
# Docker Commands
122
# ============================================================================
123
124
+
# Build Docker image (local)
125
docker-build:
126
@echo "Building Docker image $(DOCKER_FULL_IMAGE)..."
127
docker build \
···
132
.
133
@echo "✓ Built: $(DOCKER_FULL_IMAGE)"
134
135
+
# Build multi-platform and push
136
+
docker-buildx:
137
+
@echo "Building multi-platform image $(DOCKER_FULL_IMAGE)..."
138
+
docker buildx build \
139
+
--platform $(DOCKER_PLATFORMS) \
140
+
--build-arg VERSION=$(VERSION) \
141
+
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
142
+
--tag $(DOCKER_FULL_IMAGE) \
143
+
--tag $(DOCKER_LATEST) \
144
+
--push \
145
+
.
146
+
@echo "✓ Built and pushed: $(DOCKER_FULL_IMAGE) ($(DOCKER_PLATFORMS))"
147
+
148
+
# Push Docker image
149
docker-push:
150
@echo "Pushing Docker image..."
151
docker push $(DOCKER_FULL_IMAGE)
152
docker push $(DOCKER_LATEST)
153
@echo "✓ Pushed: $(DOCKER_FULL_IMAGE)"
154
0
0
0
155
# Run Docker container as CLI
156
docker-run:
157
+
@docker run --rm -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) plcbundle $(CMD)
158
+
159
+
# Shortcuts
160
+
docker-info:
161
+
@docker run --rm -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) plcbundle info
162
163
+
docker-fetch:
164
+
@docker run --rm -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) plcbundle fetch
165
+
166
+
docker-verify:
167
+
@docker run --rm -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) plcbundle verify
168
+
169
+
# Run as server
170
docker-serve:
171
+
docker run --rm -it -p 8080:8080 -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) plcbundle serve --host 0.0.0.0
0
0
0
0
172
173
+
# Open shell
174
docker-shell:
175
docker run --rm -it -v $(PWD)/data:/data $(DOCKER_FULL_IMAGE) sh
176
···
197
@echo " make test-coverage - Run tests with coverage"
198
@echo " make fmt - Format code"
199
@echo " make deps - Download dependencies"
0
200
@echo ""
201
+
@echo "Release:"
202
@echo " make version - Show current version"
203
+
@echo " make bump-patch - Bump patch (0.1.0 -> 0.1.1)"
204
+
@echo " make bump-minor - Bump minor (0.1.0 -> 0.2.0)"
205
+
@echo " make bump-major - Bump major (0.1.0 -> 1.0.0)"
206
+
@echo " make release - Push tag to trigger release"
207
+
@echo " make release-build - Test build all platforms locally"
208
+
@echo " make release-publish- Publish with GoReleaser"
209
+
@echo " make release-full - Complete release (tag + binaries)"
210
@echo ""
211
@echo "Docker:"
212
+
@echo " make docker-build - Build image (current platform)"
213
+
@echo " make docker-buildx - Build multi-platform and push"
214
+
@echo " make docker-run - Run CLI (CMD='info')"
215
+
@echo " make docker-info - Show bundle info"
216
@echo " make docker-serve - Run as server"
217
+
@echo " make docker-shell - Open shell"
218
+
@echo ""
0