From dc50247b7bcecf64c0d865e062666e975f7751fc Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Wed, 31 Jul 2024 18:52:22 +0300 Subject: [PATCH] Add release workflow --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++-- GNUmakefile | 11 +++++++++-- wsl-service.wxs | 6 +++--- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c92428..860d4fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,11 +2,12 @@ name: Build and publish on: push: + tags: ['[0-9]+.[0-9]+.[0-9]+'] branches: [ master ] workflow_dispatch: jobs: - login: + build: name: Build runs-on: ubuntu-24.04 steps: @@ -16,7 +17,7 @@ jobs: submodules: recursive - name: Build gettext run: | - sudo apt-get install -y make cmake mingw-w64 msitools wixl doxygen + sudo apt-get install -y make cmake mingw-w64 msitools wixl make - name: Upload build artifacts uses: actions/upload-artifact@v4 @@ -26,6 +27,18 @@ jobs: build/*.exe build/*.dll build/*.msi + doc: + name: Update documentation + runs-on: ubuntu-24.04 + if: github.ref == 'refs/heads/master' + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install programs + run: | + sudo apt-get install -y doxygen - name: Commit Doxygen documentation run: | ( cat doc/Doxyfile ; echo "OUTPUT_DIRECTORY=doc" ) | doxygen - @@ -34,3 +47,21 @@ jobs: git add --all git commit -m "Update doxygen documentation" -a || true git push "https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" + release: + name: Release + needs: [ build ] + runs-on: ubuntu-24.04 + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Pull build artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts + path: artifacts + - name: Publish Github Release + uses: ncipollo/release-action@00fc2857229c3d51311c8ff6e4954b38203edbd4 + with: + artifacts: "artifacts/*.exe,artifacts/*.dll,artifacts/*.msi" + makeLatest: true + allowUpdates: true + generateReleaseNotes: true diff --git a/GNUmakefile b/GNUmakefile index ec5b39d..da722d8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -22,7 +22,13 @@ POPT_DLL=build/popt/src/libpopt.dll INCLUDES=-Ipopt/src/ -Ibuild OUT=build -$(foreach v, $(.VARIABLES), $(info $(v) = $($(v)))) +UUID := $(shell uuidgen) +TAG := $(shell git describe --abbrev=0 --tags --always) +COMMIT_COUNT := $(shell git rev-list $(TAG).. --count) +VERSION := $(TAG).$(COMMIT_COUNT) + +# uncomment to debug variables +#$(foreach v, $(.VARIABLES), $(info $(v) = $($(v)))) all: $(OUT)/wsl-templates.h $(OUT)/wsl-service-events.dll $(OUT)/wsl-tool.exe $(OUT)/wsl-service.exe $(OUT)/wsl-service.msi @@ -88,4 +94,5 @@ clean: $(OUT)/wsl-service.msi: $(OUT)/wsl-service.exe $(OUT)/wsl-tool.exe $(OUT)/wsl-service-events.dll wsl-service.wxs copy-mingw-dlls $(Q)echo "MSI $@" - $(Q)$(WIXL) $(WIXLFLAGS) wsl-service.wxs -o $@ + $(Q)sed -e "s/UUID/$(UUID)/" -e "s/VERSION/$(VERSION)/" wsl-service.wxs > $(OUT)/wsl-service.wxs + $(Q)$(WIXL) $(WIXLFLAGS) $(OUT)/wsl-service.wxs -o $@ diff --git a/wsl-service.wxs b/wsl-service.wxs index 15b3ad6..5094d23 100644 --- a/wsl-service.wxs +++ b/wsl-service.wxs @@ -1,11 +1,11 @@ + Language='1033' Codepage='1252' Version='VERSION'>