branch: elpa/git-commit commit 036f5cb77576dd0fd141210ec02918893b482da5 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Automatically publish statistics --- .github/workflows/stats.yml | 18 ++++++++++++++++++ Makefile | 19 +++++++++++-------- default.mk | 1 + docs/Makefile | 28 ++++++++++++++-------------- 4 files changed, 44 insertions(+), 22 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 38fb963281..9f13b95d55 100644 --- a/Makefile +++ b/Makefile @@ -58,14 +58,14 @@ help: $(info ==================) $(info ) $(info make texi - regenerate texi from org) - $(info make stats - regenerate statistics) $(info make authors - regenerate AUTHORS.md) - $(info make publish-stats - publish statistics) $(info make publish - publish snapshot manuals) $(info make release - publish release manuals) $(info make dist - create tarballs) $(info make bump-versions - bump versions for release) $(info make bump-snapshots - bump versions after release) + $(info make stats - regenerate statistics) + $(info make stats-upload - publish statistics) @printf "\n" ## Build ############################################################# @@ -149,18 +149,12 @@ clean-stats: texi: @$(MAKE) -C docs texi -stats: - @$(MAKE) -C docs stats - authors: @$(MAKE) -C docs authors @git commit --gpg-sign -m "AUTHORS.md: Update list of contributors" \ -o -- docs/AUTHORS.md @git show --pretty= -p HEAD -publish-stats: - @$(MAKE) -C docs publish-stats - publish: @$(MAKE) -C docs publish @@ -349,3 +343,12 @@ bump-snapshots: $$set_package_requires_melpa)" @git commit -a --gpg-sign -m "Reset Package-Requires for Melpa" @git show --pretty= -p HEAD + +## Statistics ######################################################## + +stats: + @$(MAKE) -C docs stats + +stats-upload: + @$(MAKE) -C docs stats-upload + diff --git a/default.mk b/default.mk index bbfdbbfad3..920ad09df3 100644 --- a/default.mk +++ b/default.mk @@ -32,6 +32,7 @@ INSTALL_INFO ?= $(shell command -v ginstall-info || printf install-info) MAKEINFO ?= makeinfo MANUAL_HTML_ARGS ?= --css-ref /assets/page.css +GITSTATS ?= gitstats GITSTATS_DIR ?= $(TOP)docs/stats GITSTATS_ARGS ?= -c style=https://magit.vc/assets/stats.css -c max_authors=999 diff --git a/docs/Makefile b/docs/Makefile index 44499bb7d2..3eb3dd8d56 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -80,8 +80,6 @@ clean: @printf "Cleaning docs/*...\n" @$(RMDIR) dir $(INFOPAGES) $(HTMLFILES) $(HTMLDIRS) $(PDFFILES) @$(RMDIR) $(EPUBFILES) $(EPUBTRASH) - -clean-stats: @$(RMDIR) $(GENSTATS_DIR) ## Release management ################################################ @@ -100,10 +98,6 @@ texi: @printf "\n" >> magit-section.texi @rm -f magit-section.texi~ -stats: - @printf "Generating statistics\n" - @gitstats $(GITSTATS_ARGS) $(TOP) $(GITSTATS_DIR) - authors: AUTHORS.md AUTHORS.md: @@ -125,14 +119,6 @@ comma := , empty := space := $(empty) $(empty) -publish-stats: stats - @printf "Uploading statistics...\n" - @aws s3 sync $(GITSTATS_DIR) $(S3_BUCKET)/stats/ - @printf "Uploaded to $(PUBLISH_URL)/stats/\n" - @printf "Generating CDN invalidation\n" - @aws cloudfront create-invalidation \ - --distribution-id $(CFRONT_DIST) --paths "/stats/*" > /dev/null - publish: $(PUBLISH_TARGETS) @printf "Uploading manuals... $(PUBLISH_TARGETS)\n" @aws s3 cp $(PKG).html $(PUBLISH_TARGET) @@ -163,6 +149,20 @@ release: $(PUBLISH_TARGETS) @aws cloudfront create-invalidation --distribution-id $(CFRONT_DIST) --paths \ "$(subst $(space),$(comma),$(addprefix $(RELEASE_PATH),$(CFRONT_PATHS)))" > /dev/null +# Statistics ######################################################### + +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 + # Lisp ############################################################### # When making changes here, then also adjust the copy in magit-base.el.