diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e6057f8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Create release +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' +jobs: + build: + runs-on: ubuntu-latest + name: Create release + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install packages + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: make sassc zip + version: 1.0 + - name: Compile release + env: + version: ${{ github.ref_name }} + date: ${{ github.event.head_commit.timestamp }} + run: make SASS=sassc BOOKML_VERSION="$version" BOOKML_DATE="$(date --date="$date" '+%Y/%m/%d')" release + - name: Upload release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} + notes: ${{ github.event.head_commit.message }} + run: | + gh release create "$tag" --repo "$GITHUB_REPOSITORY" --title="$tag" --notes "$notes" --draft *.zip diff --git a/Makefile b/Makefile index b4865b2..94889b2 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,7 @@ BOOKML_OUT := $(BOOKML_CSS) $(BOOKML_XSLT) $(BOOKML_LTX) $(BOOKML_LTXML) $(BOO RELEASE_OUT := $(patsubst %,bookml/%,$(GITBOOK_OUT)) $(BOOKML_OUT) bookml/GNUmakefile BOOKML_VERSION = $(shell git log HEAD^..HEAD --format='%(describe)') +BOOKML_DATE = $(shell git log HEAD^..HEAD --format='%ad' --date='format:%Y/%m/%d') .PHONY: all release clean test docker docker-amd64 docker-arm64 docker-texlive docker-texlive-amd64 docker-texlive-arm64 .PRECIOUS: @@ -132,8 +133,7 @@ bookml/GNUmakefile: template/GNUmakefile | $(BOOKML_DIRS) bookml/bookml.sty: bookml.sty | $(BOOKML_DIRS) $(patsubst %,bookml/%,bookml.mk bookml.sty bookml.sty.ltxml XSLT/utils.xsl): bookml/%: % | $(BOOKML_DIRS) - $(eval _date:=$(shell git log HEAD^..HEAD --format='%ad' --date='format:%Y/%m/%d')) - perl -pe "s!\@DATE@!$(_date)!g; s!\@VERSION@!$(BOOKML_VERSION)!g" "$<" > "$@" + perl -pe "s!\@DATE@!$(BOOKML_DATE)!g; s!\@VERSION@!$(BOOKML_VERSION)!g" "$<" > "$@" # fix erratic positioning of the prev/next buttons due to buggy rounding gitbook/js/app.min.js: $(GITBOOK_SOURCE)/js/app.min.js | $(GITBOOK_DIRS) diff --git a/XSLT/gitbook.xsl b/XSLT/gitbook.xsl index c70b772..ac3a867 100644 --- a/XSLT/gitbook.xsl +++ b/XSLT/gitbook.xsl @@ -216,10 +216,10 @@ - +