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:
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
#!/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}')
NEW_VERSION="$1"
fi
-# CONTRIBUTORS
printf "#### Contributors\n\n" > CONTRIBUTORS.md
-make CONTRIBUTORS >> CONTRIBUTORS.md
+cat _CONTRIBUTORS >> CONTRIBUTORS.md
# Update AUTHORS
make 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}"