branch: elpa/with-editor commit 8f112d3aef018ac2956999af544803331be3cdde Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Automatically publish statistics --- .github/workflows/stats.yml | 18 ++++++++++++++++++ Makefile | 9 +++++++-- docs/Makefile | 18 +++++++++++++----- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml new file mode 100644 index 0000000000..96f261b489 --- /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 623c3486ad..edf242d6d3 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ help: $(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 +37,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 15c20aa42d..c0b03ded5f 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: