From 6abef0e9e7638d16bbe59cfd88c72b680699fe34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 25 Apr 2024 16:38:54 +0300 Subject: [PATCH] Add release automation Once a tag is pushed to github, it will: - create a "release archive" - create the release with the release archive The release will be a "pre-release draft", so a human will need to go and make it "latest and greatest". Example what happened in my fork when I pushed the tag: https://github.com/motiejus/inotify-info/actions/runs/8833871736/job/24254232221 https://github.com/motiejus/inotify-info/releases/tag/untagged-821f6dd9487d26fa828c --- .github/workflows/release.yaml | 22 ++++++++++++++++++++++ .gitignore | 2 ++ Makefile | 6 ++++++ 3 files changed, 30 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..f5e422f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,22 @@ +--- +name: release +on: + push: + tags: + - 'v*' +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Archive + run: make inotify-info-${{ github.ref_name }}.tar.gz + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/v') + with: + files: inotify-info-${{ github.ref_name }}.tar.gz + generate_release_notes: true + draft: true + prerelease: true diff --git a/.gitignore b/.gitignore index 08376e7..d8a5a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ _debug/ _release/ + +/inotify-info-v*.tar.gz diff --git a/Makefile b/Makefile index 643c951..6bf0e0a 100644 --- a/Makefile +++ b/Makefile @@ -109,3 +109,9 @@ clean: $(VERBOSE_PREFIX)$(RM) $(OBJS) $(VERBOSE_PREFIX)$(RM) $(OBJS:.o=.d) $(VERBOSE_PREFIX)$(RM) $(OBJS:.o=.dwo) + +define RELEASE_RULES +inotify-info-$(TAG).tar.gz: + git archive --prefix=inotify-info-$(TAG)/ $(TAG) | gzip -n > $$@ +endef +$(foreach TAG,$(shell git tag 2>/dev/null),$(eval $(RELEASE_RULES)))