Skip to content

Commit

Permalink
make: Update publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsius committed Dec 16, 2021
1 parent adc611d commit ba10946
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ help:
$(info make html-dir - generate html manual directory)
$(info make pdf - generate pdf manual)
$(info make stats - generate statistics)
$(info make preview - preview html and pdf manuals)
$(info make publish - publish html and pdf manuals)
$(info make publish - publish snapshot manuals)
$(info make release - publish release manuals)
$(info make clean - remove most generated files)
@printf "\n"

Expand Down
3 changes: 3 additions & 0 deletions default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ ELCS = $(ELS:.el=.elc)

DEPS =

DOMAIN ?= emacsmirror.net
CFRONT_DIST ?= E1IXJGPIOM4EUW

EMACS ?= emacs
EMACS_ARGS ?=

Expand Down
39 changes: 22 additions & 17 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,34 @@ stats:
@printf "Generating statistics\n"
@gitstats -c style=https://magit.vc/assets/stats.css -c max_authors=999 $(TOP) $(STATS_DIR)

DOMAIN ?= emacsmirror.net
CFRONT_DIST ?= E1IXJGPIOM4EUW
PUBLISH_PATH ?= /manual/
PUBLISH_BUCKET ?= s3://$(DOMAIN)
PREVIEW_BUCKET ?= s3://preview.$(DOMAIN)
PUBLISH_TARGET ?= $(PUBLISH_BUCKET)$(PUBLISH_PATH)
PREVIEW_TARGET ?= $(PREVIEW_BUCKET)$(PUBLISH_PATH)
RELEASE_PATH ?= /manual/$(VERSION)/
S3_BUCKET ?= s3://$(DOMAIN)
PUBLISH_TARGET = $(S3_BUCKET)$(PUBLISH_PATH)
RELEASE_TARGET = $(S3_BUCKET)$(RELEASE_PATH)
CFRONT_PATHS = $(PKG).html $(PKG).pdf $(PKG)/*

preview: html html-dir pdf
@aws s3 cp $(PKG).html $(PREVIEW_TARGET)
@aws s3 cp $(PKG).pdf $(PREVIEW_TARGET)
@aws s3 sync $(PKG) $(PREVIEW_TARGET)$(PKG)/
comma := ,
empty :=
space := $(empty) $(empty)

publish: html html-dir pdf
@aws s3 cp $(PKG).html $(PUBLISH_TARGET)
@aws s3 cp $(PKG).pdf $(PUBLISH_TARGET)
@aws s3 sync $(PKG) $(PUBLISH_TARGET)$(PKG)/
@aws s3 cp $(PKG).pdf $(PUBLISH_TARGET)
@aws s3 sync $(PKG) $(PUBLISH_TARGET)$(PKG)/
@printf "Generating CDN invalidation\n"
@aws cloudfront create-invalidation \
--distribution-id $(CFRONT_DIST) --paths "\
$(PUBLISH_PATH)$(PKG).html,\
$(PUBLISH_PATH)$(PKG).pdf,\
$(PUBLISH_PATH)$(PKG)/*" > /dev/null
@aws cloudfront create-invalidation --distribution-id $(CFRONT_DIST) --paths \
"$(subst $(space),$(comma),$(addprefix $(PUBLISH_PATH),$(CFRONT_PATHS)))" > /dev/null

release: html html-dir pdf
@aws s3 cp $(PKG).html $(RELEASE_TARGET)
@aws s3 cp $(PKG).pdf $(RELEASE_TARGET)
@aws s3 sync $(PKG) $(RELEASE_TARGET)$(PKG)/
@aws s3 cp $(PUBLISH_TARGET)dir.html $(RELEASE_TARGET)dir.html
@aws s3 cp $(PUBLISH_TARGET)dir/index.html $(RELEASE_TARGET)dir/index.html
@printf "Generating CDN invalidation\n"
@aws cloudfront create-invalidation --distribution-id $(CFRONT_DIST) --paths \
"$(subst $(space),$(comma),$(addprefix $(RELEASE_PATH),$(CFRONT_PATHS)))" > /dev/null

CLEAN = $(PKG).info dir $(PKG) $(PKG).html $(PKG).pdf

Expand Down

0 comments on commit ba10946

Please sign in to comment.