|
1 |
| -requirements_frozen.txt requirements.nix requirements_override.nix: requirements.txt |
2 |
| - pypi2nix -V 3.6 -r $^ |
| 1 | +VERSION?=$$(git rev-parse --abbrev-ref HEAD) |
3 | 2 |
|
4 | 3 | .PHONY: all
|
5 |
| -all: requirements_frozen.txt requirements.nix requirements_override.nix default.nix |
6 |
| - nix-build -K . |
| 4 | +all: requirements_frozen.txt requirements.nix requirements_override.nix marge-bot dockerize |
| 5 | + |
| 6 | +.PHONY: marge-bot |
| 7 | +marge-bot: |
| 8 | + nix-build --keep-failed --attr marge-bot default.nix |
7 | 9 |
|
8 | 10 | .PHONY: clean
|
9 | 11 | clean:
|
10 |
| - rm -rf .cache result requirements_frozen.txt |
| 12 | + rm -rf .cache result result-* requirements_frozen.txt |
| 13 | + |
| 14 | +.PHONY: bump |
| 15 | +bump: bump-requirements bump-sources |
| 16 | + |
| 17 | +.PHONY: bump-sources |
| 18 | +bump-sources: |
| 19 | + nix-shell --run niv update |
11 | 20 |
|
12 | 21 | .PHONY: bump-requirements
|
13 | 22 | bump-requirements: clean requirements_frozen.txt
|
14 | 23 |
|
15 |
| -.PHONY: dockerize |
16 |
| -dockerize: dockerize.nix |
17 |
| - docker load --input $$(nix-build dockerize.nix) |
| 24 | +requirements_frozen.txt requirements.nix requirements_override.nix: requirements.txt |
| 25 | + pypi2nix -V 3.6 -r $^ |
18 | 26 |
|
| 27 | +.PHONY: dockerize |
| 28 | +dockerize: |
| 29 | + docker load --input $$(nix-build --attr docker-image default.nix) |
19 | 30 |
|
20 | 31 | .PHONY: docker-push
|
21 | 32 | docker-push:
|
22 | 33 | if [ -n "$$DOCKER_USERNAME" -a -n "$$DOCKER_PASSWORD" ]; then \
|
23 |
| - docker login -u "$${DOCKER_USERNAME}" -p "$${DOCKER_PASSWORD}"; \ |
| 34 | + docker login -u "$${DOCKER_USERNAME}" -p "$${DOCKER_PASSWORD}"; \ |
24 | 35 | else \
|
25 |
| - docker login; \ |
| 36 | + docker login; \ |
| 37 | + fi |
| 38 | + docker tag smarkets/marge-bot:$$(cat version) smarkets/marge-bot:$(VERSION) |
| 39 | + if [ "$(VERSION)" = "$$(cat version)" ]; then \ |
| 40 | + docker tag smarkets/marge-bot:$$(cat version) smarkets/marge-bot:latest; \ |
| 41 | + docker tag smarkets/marge-bot:$$(cat version) smarkets/marge-bot:stable; \ |
| 42 | + docker push smarkets/marge-bot:stable; \ |
| 43 | + docker push smarkets/marge-bot:latest; \ |
26 | 44 | fi
|
27 |
| - docker tag smarkets/marge-bot:$$(cat version) smarkets/marge-bot:latest |
28 |
| - docker push smarkets/marge-bot:$$(cat version) |
29 |
| - docker push smarkets/marge-bot:latest |
| 45 | + docker push smarkets/marge-bot:$(VERSION) |
30 | 46 | # for backwards compatibility push to previous location
|
31 |
| - docker tag smarkets/marge-bot:latest smarketshq/marge-bot:latest |
32 |
| - docker tag smarkets/marge-bot:latest smarketshq/marge-bot:$$(cat version) |
33 |
| - docker push smarketshq/marge-bot:$$(cat version) |
| 47 | + docker tag smarkets/marge-bot:$$(cat version) smarketshq/marge-bot:latest |
| 48 | + docker tag smarkets/marge-bot:$$(cat version) smarketshq/marge-bot:$(VERSION) |
| 49 | + docker push smarketshq/marge-bot:$(VERSION) |
34 | 50 | docker push smarketshq/marge-bot:latest
|
0 commit comments