Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (43 loc) · 2.31 KB
/
Copy pathMakefile
File metadata and controls
49 lines (43 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
IMAGE_TAG ?= docker-rustpython
# All: linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x
# Supported by rust (Debian variant, alpine has 2 less): linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8
# Supported by alpine: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
# s390x used to not build (https://github.com/nix-rust/nix/issues/1968,
# https://github.com/nix-rust/nix/pull/1835); both are closed since 2023-12-16
# and the pinned RustPython uses nix 0.32.0, so it is in the build matrix again.
PLATFORM ?= linux/amd64
ACTION ?= load
PROGRESS_MODE ?= plain
EXTRA_ARGS ?=
# Single source of truth for the release tag: the version pinned in the
# Dockerfile. Override RELEASE_TAG to add a rebuild counter, e.g.
# RELEASE_TAG=v2026-11-30-main-110-2 make update-tags
RUST_PYTHON_VERSION := $(shell sed -n 's/^ARG RUST_PYTHON_VERSION="\(.*\)"$$/\1/p' docker/Dockerfile | head -n1)
RELEASE_TAG ?= v$(RUST_PYTHON_VERSION)
.PHONY: docker-build
docker-build:
# https://github.com/docker/buildx#building
docker buildx build \
--tag $(IMAGE_TAG) \
--progress $(PROGRESS_MODE) \
--platform $(PLATFORM) \
--build-arg VCS_REF=`git rev-parse HEAD` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--$(ACTION) \
$(EXTRA_ARGS) \
./docker
.PHONY: update-tags
# Create the signed release tag for the RustPython version pinned in
# docker/Dockerfile, and push it. publish.yml only reacts to
# `release: types: [released]`, so the tag alone publishes nothing: finish with
# gh release create $(RELEASE_TAG) --generate-notes
update-tags:
@test -n "$(RUST_PYTHON_VERSION)" || { echo "error: could not parse RUST_PYTHON_VERSION from docker/Dockerfile" >&2; exit 1; }
@test -z "$$(git status --porcelain)" || { echo "error: working tree is dirty, commit the version change first" >&2; exit 1; }
@if git rev-parse -q --verify "refs/tags/$(RELEASE_TAG)" >/dev/null; then echo "error: tag $(RELEASE_TAG) already exists" >&2; exit 1; fi
git tag -s $(RELEASE_TAG) -m "RustPython $(RUST_PYTHON_VERSION)"
git push origin $(RELEASE_TAG)
@echo
@echo "Tagged and pushed $(RELEASE_TAG)."
@echo "publish.yml listens for a GitHub release, not a tag, so finish with:"
@echo " gh release create $(RELEASE_TAG) --title $(RELEASE_TAG) --generate-notes"