]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
ci: automate release generation
authorHenrik Gombos <henrik99999@gmail.com>
Sun, 16 Jul 2023 17:03:47 +0000 (13:03 -0400)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Wed, 26 Jul 2023 11:27:13 +0000 (07:27 -0400)
.github/workflows/release.yml
tools/release.sh

index d006be2c9d305b31d8d4a29ea0af7787b1d02062..7497d6ec3a9989e89739b2973b39cc2eaae92fe0 100644 (file)
@@ -1,6 +1,9 @@
 name: Release
 
 on:
+  schedule:
+    ## Schedule the job to run on Apr-1, Aug-1, Dec-1
+    - cron: '0 0 1 APR,AUG,DEC *'
   workflow_dispatch:
     inputs:
       tag:
@@ -23,8 +26,9 @@ jobs:
         run: bash ${GITHUB_WORKSPACE}/tools/release.sh ${{ inputs.tag }}
 
       - name: Release
+        if: ${{ env.new_version }}
         uses: softprops/action-gh-release@v0.1.15
         with:
-          tag_name: ${{ inputs.tag }}
-          name: dracut-${{ inputs.tag }}
+          tag_name: ${{ env.new_version }}
+          name: dracut-${{ env.new_version }}
           body_path: ${{ github.workspace }}/release.md
index 5900c0ab8bb59cee340344bfadf30e341e7b451d..05527c3b32f681630efaa13a6822cf89dd3d24c7 100755 (executable)
@@ -1,5 +1,13 @@
 #!/bin/bash
 
+# CONTRIBUTORS
+make CONTRIBUTORS > _CONTRIBUTORS
+if [ ! -s _CONTRIBUTORS ]; then
+    # no CONTRIBUTORS means no need to make a release
+    # exit without populating new_version
+    exit 0
+fi
+
 if [ -z "$1" ]; then
     LAST_VERSION=$(git describe --abbrev=0 --tags --always 2> /dev/null)
     NEW_VERSION=$(echo "$LAST_VERSION" | awk '{print ++$1}')
@@ -10,9 +18,8 @@ else
     NEW_VERSION="$1"
 fi
 
-# CONTRIBUTORS
 printf "#### Contributors\n\n" > CONTRIBUTORS.md
-make CONTRIBUTORS >> CONTRIBUTORS.md
+cat _CONTRIBUTORS >> CONTRIBUTORS.md
 
 # Update AUTHORS
 make AUTHORS
@@ -41,3 +48,6 @@ git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS
 git push origin master
 git tag "$NEW_VERSION" -m "$NEW_VERSION"
 git push --tags
+
+# export new version to Github Action
+echo "new_version=${NEW_VERSION,,}" >> "${GITHUB_ENV}"