mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
move release script to Makefile
This commit is contained in:
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@@ -205,6 +205,12 @@ jobs:
|
||||
echo "GOVER=$(sed -n 's/^go \(.*\)/\1/p' go.mod)" >> $GITHUB_OUTPUT
|
||||
id: goversion
|
||||
|
||||
- name: "Get aptly version"
|
||||
run: |
|
||||
# Because dpkg-parsechangelog is not installed, will return the latest git tag
|
||||
echo "VERSION=$(make version RELEASE=yes)" >> $GITHUB_OUTPUT
|
||||
id: releaseversion
|
||||
|
||||
- name: "Setup Go"
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
@@ -214,23 +220,13 @@ jobs:
|
||||
env:
|
||||
GOBIN: /usr/local/bin
|
||||
run: |
|
||||
mkdir -p tmp/man tmp/completion/bash_completion.d tmp/completion/zsh/vendor-completions
|
||||
go version
|
||||
echo ${{ github.ref_name }} > VERSION
|
||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o tmp/aptly -ldflags='-extldflags=-static'
|
||||
cp man/aptly.1 tmp/man/
|
||||
cp completion.d/aptly tmp/completion/bash_completion.d/
|
||||
cp completion.d/_aptly tmp/completion/zsh/vendor-completions/
|
||||
gzip tmp/man/aptly.1
|
||||
path="aptly_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||
mkdir -p $path
|
||||
mv tmp "$path"
|
||||
zip -r "$path" . -i "$path/*"
|
||||
echo ${{ steps.releaseversion.outputs.VERSION }} > VERSION
|
||||
make release GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: aptly_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
||||
path: aptly_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
||||
name: aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
||||
path: build/aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
||||
|
||||
gh-release:
|
||||
name: "Github Release: ${{ github.ref_name }}"
|
||||
|
||||
24
Makefile
24
Makefile
@@ -1,11 +1,14 @@
|
||||
GOPATH=$(shell go env GOPATH)
|
||||
VERSION=$(shell make version)
|
||||
VERSION=$(shell make -s version)
|
||||
PYTHON?=python3
|
||||
TESTS?=
|
||||
BINPATH?=$(GOPATH)/bin
|
||||
RUN_LONG_TESTS?=yes
|
||||
GOLANGCI_LINT_VERSION=v1.54.1 # version supporting go 1.19
|
||||
COVERAGE_DIR?=$(shell mktemp -d)
|
||||
GOOS=$(shell go env GOHOSTOS)
|
||||
GOARCH=$(shell go env GOHOSTARCH)
|
||||
RELEASE=no
|
||||
# Uncomment to update test outputs
|
||||
# CAPTURE := "--capture"
|
||||
|
||||
@@ -103,6 +106,22 @@ build: ## Build aptly
|
||||
go generate
|
||||
go build -o build/aptly
|
||||
|
||||
release: version ## build release archive in build/ for GOOS and GOARCH
|
||||
@mkdir -p build/tmp/man build/tmp/completion/bash_completion.d build/tmp/completion/zsh/vendor-completions
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o build/tmp/aptly -ldflags='-extldflags=-static'
|
||||
@cp man/aptly.1 build/tmp/man/
|
||||
@cp completion.d/aptly build/tmp/completion/bash_completion.d/
|
||||
@cp completion.d/_aptly build/tmp/completion/zsh/vendor-completions/
|
||||
@gzip -f build/tmp/man/aptly.1
|
||||
@path="aptly_$(VERSION)_$(GOOS)_$(GOARCH)"; \
|
||||
rm -rf "build/$$path"; \
|
||||
mv build/tmp build/"$$path"; \
|
||||
rm -rf build/tmp; \
|
||||
cd build; \
|
||||
zip -r "$$path".zip "$$path" > /dev/null \
|
||||
&& echo "Built build/$${path}.zip"; \
|
||||
rm -rf "$$path"
|
||||
|
||||
docker-image: ## Build aptly-dev docker image
|
||||
@docker build -f system/Dockerfile . -t aptly-dev
|
||||
|
||||
@@ -124,6 +143,9 @@ docker-system-tests: ## Run system tests in docker container (add TEST=t04_mirr
|
||||
docker-lint: ## Run golangci-lint in docker container
|
||||
@docker run -it --rm -v ${PWD}:/app -e GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION) aptly-dev /app/system/run-golangci-lint
|
||||
|
||||
docker-release:
|
||||
@docker run -it --rm -v ${PWD}:/app aptly-dev /app/system/run-release
|
||||
|
||||
flake8: ## run flake8 on system tests
|
||||
flake8 system
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ RUN echo deb http://deb.debian.org/debian bookworm-backports main > /etc/apt/sou
|
||||
|
||||
RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg apg bzip2 xz-utils ca-certificates \
|
||||
golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports \
|
||||
make git python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage g++ python3-etcd3 python3-plyvel graphviz devscripts sudo dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf bash-completion && \
|
||||
make git python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage g++ python3-etcd3 python3-plyvel graphviz devscripts sudo dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf bash-completion zip && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd -m --shell /bin/sh --home-dir /var/lib/aptly aptly
|
||||
|
||||
9
system/run-release
Executable file
9
system/run-release
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# cleanup
|
||||
rm -rf /app/build/tmp
|
||||
|
||||
usermod -u `stat -c %u /app` aptly >/dev/null
|
||||
chown -R `stat -c %u /app` /var/lib/aptly
|
||||
|
||||
su - aptly -c "cd /app; export GOPATH=/app/.go; make release"
|
||||
Reference in New Issue
Block a user