From: Henrik Gombos Date: Sun, 16 Jul 2023 17:03:47 +0000 (-0400) Subject: ci: automate release generation X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e1e924550a23b7fbbca5f752f32a749631db116;p=thirdparty%2Fdracut.git ci: automate release generation --- diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d006be2c9..7497d6ec3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/tools/release.sh b/tools/release.sh index 5900c0ab8..05527c3b3 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -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}"