Skip to content

Commit

Permalink
Merge pull request #750 from phunkyfish/update-release-action
Browse files Browse the repository at this point in the history
Allow date in changelog optionally and add delay before release step
  • Loading branch information
phunkyfish authored Jul 18, 2021
2 parents 284edd3 + 32f252a commit fe622f7
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/changelog-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: 'Update news in addon.xml.in? [true|false]'
required: true
default: 'true'
add_date:
description: 'Add date to version number in changelog and news. ie. "v1.0.1 (2021-7-17)" [true|false]'
required: true
default: 'true'

jobs:
default:
Expand Down Expand Up @@ -47,15 +51,16 @@ jobs:

- name: Increment version and update changelogs
run: |
arguments=
if [[ ${{ github.event.inputs.update_news }} == true ]] ;
then
python3 ../scripts/changelog_and_release.py ${{ github.event.inputs.version_type }} ${{ github.event.inputs.changelog_text }} --update-news
elif [[ ${{ github.event.inputs.update_news }} == false ]] ;
arguments=$(echo $arguments && echo --update-news)
fi
if [[ ${{ github.event.inputs.add_date }} == true ]] ;
then
python3 ../scripts/changelog_and_release.py ${{ github.event.inputs.version_type }} ${{ github.event.inputs.changelog_text }}
else
exit 1
arguments=$(echo $arguments && echo --add-date)
fi
python3 ../scripts/changelog_and_release.py ${{ github.event.inputs.version_type }} ${{ github.event.inputs.changelog_text }} $arguments
working-directory: ${{ github.event.repository.name }}

- name: Get required variables
Expand All @@ -72,13 +77,19 @@ jobs:
echo ::set-output name=version::$version
branch=$(echo ${GITHUB_REF#refs/heads/})
echo ::set-output name=branch::$branch
echo ::set-output name=today::$(date +'%Y-%m-%d')
working-directory: ${{ github.event.repository.name }}

- name: Commit changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "changelog and version v${{ steps.required-variables.outputs.version }}" -a
commit_message="changelog and version v${{ steps.required-variables.outputs.version }}"
if [[ ${{ github.event.inputs.add_date }} == true ]] ;
then
commit_message="$commit_message (${{ steps.required-variables.outputs.today }})"
fi
git commit -m "$commit_message" -a
working-directory: ${{ github.event.repository.name }}

- name: Push changes
Expand All @@ -87,6 +98,10 @@ jobs:
branch: ${{ github.ref }}
directory: ${{ github.event.repository.name }}

- name: Sleep for 60 seconds
run: sleep 60s
shell: bash

- name: Create Release
id: create-release
uses: actions/create-release@v1
Expand Down

0 comments on commit fe622f7

Please sign in to comment.