Skip to content

Commit

Permalink
Allow version update with workflow dispatch (#1655)
Browse files Browse the repository at this point in the history
* Allow version update with workflow dispatch

Was looking to trigger the version update workflow by re-creating the release 24.7.0. However when a release it re-created from the same commit which has been created a release, it does not seems to trigger the even type released. Added workflow_dispatch also to the same workflow so that users can manually trigger the version update if necessary.

Signed-off-by: Chaminda Divitotawela <[email protected]>

* Actionlint fixes

Signed-off-by: Chaminda Divitotawela <[email protected]>

---------

Signed-off-by: Chaminda Divitotawela <[email protected]>
  • Loading branch information
cdivitotawela authored Jul 17, 2024
1 parent 7fdbd9a commit 3294b7f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@ name: Update Version

on:
release:
types: [released]
types: ["released"]
workflow_dispatch:
inputs:
version:
type: string
required: true

jobs:
update:
runs-on: ubuntu-latest
env:
VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.event.release.name }}
permissions:
contents: write
pull-requests: write
steps:
- name: Check release name
- name: Validate version
id: version
run: |
# User can input anything so check what is provided as release name
echo "${{ github.event.release.name }}" | grep -q -e "^[0-9]*\.[0-9]*\.[0-9]*$" || {
echo "Release name [$RELEASE_NAME] is not in expected format '^[0-9]*\.[0-9]*\.[0-9]*$'"
# Validate provided version compatible with the format
echo "${{ env.VERSION }}" | grep -q -e "^[0-9]*\.[0-9]*\.[0-9]*$" || {
echo "Version [${{ env.VERSION }}] is not in expected format '^[0-9]*\.[0-9]*\.[0-9]*$'"
exit 1
}
Expand All @@ -32,5 +39,5 @@ jobs:
- name: Update version
run: .github/scripts/update-version.sh
env:
VERSION: ${{ github.event.release.name }}
VERSION: ${{ env.VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 3294b7f

Please sign in to comment.