rename 'make release' into 'make binaries'

This commit is contained in:
aler9 2022-09-17 20:15:23 +02:00
parent 7fd749cf0e
commit e70e6084da
5 changed files with 18 additions and 18 deletions

View File

@ -1,6 +1,6 @@
# do not add .git, since it is needed to extract the tag
/tmp
/release
/binaries
/coverage*.txt
/apidocs/*.html

View File

@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: make release
- run: make binaries
- uses: actions/github-script@v6
with:
@ -31,13 +31,13 @@ jobs:
});
const release_id = res.data.id;
for (const name of await fs.readdir('./release/')) {
for (const name of await fs.readdir('./binaries/')) {
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id,
name,
data: await fs.readFile(`./release/${name}`),
data: await fs.readFile(`./binaries/${name}`),
});
}

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
/tmp
/release
/binaries
/coverage*.txt
/apidocs/*.html

View File

@ -20,7 +20,7 @@ help:
@echo " run run app"
@echo " apidocs-lint run api docs linters"
@echo " apidocs-gen generate api docs HTML"
@echo " release build release assets"
@echo " binaries build binaries for all platforms"
@echo " dockerhub build and push images to Docker Hub"
@echo ""

View File

@ -1,4 +1,4 @@
define DOCKERFILE_RELEASE
define DOCKERFILE_BINARIES
FROM $(RPI32_IMAGE) AS rpicamera32
RUN ["cross-build-start"]
RUN apt update && apt install -y g++ pkg-config make libcamera-dev
@ -22,36 +22,36 @@ COPY . ./
ENV VERSION $(shell git describe --tags)
ENV CGO_ENABLED 0
RUN mkdir tmp release
RUN mkdir tmp binaries
RUN cp rtsp-simple-server.yml tmp/
RUN GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/aler9/rtsp-simple-server/internal/core.version=$$VERSION" -o tmp/rtsp-simple-server.exe
RUN cd tmp && zip -q ../release/rtsp-simple-server_$${VERSION}_windows_amd64.zip rtsp-simple-server.exe rtsp-simple-server.yml
RUN cd tmp && zip -q ../binaries/rtsp-simple-server_$${VERSION}_windows_amd64.zip rtsp-simple-server.exe rtsp-simple-server.yml
RUN GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/aler9/rtsp-simple-server/internal/core.version=$$VERSION" -o tmp/rtsp-simple-server
RUN tar -C tmp -czf release/rtsp-simple-server_$${VERSION}_linux_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN tar -C tmp -czf binaries/rtsp-simple-server_$${VERSION}_linux_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/aler9/rtsp-simple-server/internal/core.version=$$VERSION" -o tmp/rtsp-simple-server
RUN tar -C tmp -czf release/rtsp-simple-server_$${VERSION}_darwin_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN tar -C tmp -czf binaries/rtsp-simple-server_$${VERSION}_darwin_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
COPY --from=rpicamera32 /s/internal/rpicamera/exe/exe internal/rpicamera/exe/
RUN GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-X github.com/aler9/rtsp-simple-server/internal/core.version=$$VERSION" -o tmp/rtsp-simple-server -tags rpicamera
RUN tar -C tmp -czf release/rtsp-simple-server_$${VERSION}_linux_armv6.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN tar -C tmp -czf binaries/rtsp-simple-server_$${VERSION}_linux_armv6.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN rm internal/rpicamera/exe/exe
COPY --from=rpicamera32 /s/internal/rpicamera/exe/exe internal/rpicamera/exe/
RUN GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-X github.com/aler9/rtsp-simple-server/internal/core.version=$$VERSION" -o tmp/rtsp-simple-server -tags rpicamera
RUN tar -C tmp -czf release/rtsp-simple-server_$${VERSION}_linux_armv7.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN tar -C tmp -czf binaries/rtsp-simple-server_$${VERSION}_linux_armv7.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN rm internal/rpicamera/exe/exe
COPY --from=rpicamera64 /s/internal/rpicamera/exe/exe internal/rpicamera/exe/
RUN GOOS=linux GOARCH=arm64 go build -ldflags "-X github.com/aler9/rtsp-simple-server/internal/core.version=$$VERSION" -o tmp/rtsp-simple-server -tags rpicamera
RUN tar -C tmp -czf release/rtsp-simple-server_$${VERSION}_linux_arm64v8.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN tar -C tmp -czf binaries/rtsp-simple-server_$${VERSION}_linux_arm64v8.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
RUN rm internal/rpicamera/exe/exe
endef
export DOCKERFILE_RELEASE
export DOCKERFILE_BINARIES
release:
echo "$$DOCKERFILE_RELEASE" | DOCKER_BUILDKIT=1 docker build . -f - -t temp
binaries:
echo "$$DOCKERFILE_BINARIES" | DOCKER_BUILDKIT=1 docker build . -f - -t temp
docker run --rm -v $(PWD):/out \
temp sh -c "rm -rf /out/release && cp -r /s/release /out/"
temp sh -c "rm -rf /out/binaries && cp -r /s/binaries /out/"