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