summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2022-03-20 16:43:47 +0100
committerJonas Bernoulli <jonas@bernoul.li>2022-03-20 16:43:47 +0100
commit0619c7ef198349c11c8ef598c7caa741b3c4c9b0 (patch)
treec10369052f44a413e9fe3d035adf876b453c5124
parent017eb7b3cb631bb432066539c459bfa96afa0543 (diff)
Automatically publish statistics
-rw-r--r--.github/workflows/stats.yml18
-rw-r--r--Makefile10
-rw-r--r--docs/Makefile18
3 files changed, 38 insertions, 8 deletions
diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml
new file mode 100644
index 0000000..96f261b
--- /dev/null
+++ b/.github/workflows/stats.yml
@@ -0,0 +1,18 @@
+name: stats
+on:
+ push:
+ branches: master
+jobs:
+ manual:
+ name: "Generate and distribute statistics"
+ runs-on: ubuntu-latest
+ steps:
+ - name: Install gitstats
+ uses: magit/actions/install-gitstats@main
+ - name: Generate statistics
+ uses: magit/actions/stats-generate@main
+ - name: Publish statistics
+ uses: magit/actions/stats-publish@main
+ with:
+ key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ secret: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
diff --git a/Makefile b/Makefile
index 623c348..2117e62 100644
--- a/Makefile
+++ b/Makefile
@@ -14,9 +14,10 @@ help:
$(info make html - generate html manual file)
$(info make html-dir - generate html manual directory)
$(info make pdf - generate pdf manual)
- $(info make stats - generate statistics)
$(info make publish - publish snapshot manuals)
$(info make release - publish release manuals)
+ $(info make stats - generate statistics)
+ $(info make stats-upload - publish statistics)
$(info make clean - remove most generated files)
@printf "\n"
@@ -35,14 +36,17 @@ html-dir:
@$(MAKE) -C docs html-dir
pdf:
@$(MAKE) -C docs pdf
-stats:
- @$(MAKE) -C docs stats
publish:
@$(MAKE) -C docs publish
release:
@$(MAKE) VERSION=$(VERSION) -C docs release
+stats:
+ @$(MAKE) -C docs stats
+stats-upload:
+ @$(MAKE) -C docs stats-upload
+
clean:
@$(MAKE) -C lisp clean
@$(MAKE) -C docs clean
diff --git a/docs/Makefile b/docs/Makefile
index 15c20aa..c0b03de 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -52,11 +52,6 @@ html-dir: $(PKG).texi
@printf "Generating $@\n"
@texi2pdf --clean $< > /dev/null
-.PHONY: stats
-stats:
- @printf "Generating statistics\n"
- @gitstats $(GITSTATS_ARGS) $(TOP) $(GITSTATS_DIR)
-
PUBLISH_PATH ?= /manual/
RELEASE_PATH ?= /manual/$(VERSION)/
S3_BUCKET ?= s3://$(DOMAIN)
@@ -86,6 +81,19 @@ release: html html-dir pdf
@aws cloudfront create-invalidation --distribution-id $(CFRONT_DIST) --paths \
"$(subst $(space),$(comma),$(addprefix $(RELEASE_PATH),$(CFRONT_PATHS)))" > /dev/null
+.PHONY: stats
+stats:
+ @printf "Generating statistics\n"
+ @$(GITSTATS) $(GITSTATS_ARGS) $(TOP) $(GITSTATS_DIR)
+
+stats-upload:
+ @printf "Uploading statistics...\n"
+ @aws s3 sync $(GITSTATS_DIR) $(S3_BUCKET)/stats/$(PKG)
+ @printf "Uploaded to $(S3_BUCKET)/stats/$(PKG)\n"
+ @printf "Generating CDN invalidation\n"
+ @aws cloudfront create-invalidation \
+ --distribution-id $(CFRONT_DIST) --paths "/stats/*" > /dev/null
+
CLEAN = $(PKG).info dir $(PKG) $(PKG).html $(PKG).pdf
clean: