From e70e6084da2719e5bc69d732c0cda4595954be43 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sat, 17 Sep 2022 20:15:23 +0200 Subject: [PATCH] rename 'make release' into 'make binaries' --- .dockerignore | 2 +- .github/workflows/release.yml | 6 +++--- .gitignore | 2 +- Makefile | 2 +- scripts/{release.mk => binaries.mk} | 24 ++++++++++++------------ 5 files changed, 18 insertions(+), 18 deletions(-) rename scripts/{release.mk => binaries.mk} (65%) diff --git a/.dockerignore b/.dockerignore index 0f354a00..49f255b9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,6 @@ # do not add .git, since it is needed to extract the tag /tmp -/release +/binaries /coverage*.txt /apidocs/*.html diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77d3a1ec..20dc35d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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}`), }); } diff --git a/.gitignore b/.gitignore index fb2b06ea..406789cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /tmp -/release +/binaries /coverage*.txt /apidocs/*.html diff --git a/Makefile b/Makefile index 77456392..a4a86a90 100644 --- a/Makefile +++ b/Makefile @@ -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 "" diff --git a/scripts/release.mk b/scripts/binaries.mk similarity index 65% rename from scripts/release.mk rename to scripts/binaries.mk index 8aa912da..3d735004 100644 --- a/scripts/release.mk +++ b/scripts/binaries.mk @@ -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/"