Skip to content

Commit

Permalink
create automated pull requests for new Kimai release (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
cngJo authored Aug 17, 2023
1 parent 985759f commit 7fddf37
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Save version number"
run: echo "${{steps.remote_version.outputs.version}}"
- uses: actions/checkout@v3

- name: "Update Kimai version in _config.yml"
run: scripts/update-version-number.sh "${{ github.event.client_payload.kimai_version }}"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: "Bump latest release to ${{ github.event.client_payload.kimai_version }}"
title: "Bump version to ${{ github.event.client_payload.kimai_version }}"
branch: "docs/release-${{ github.event.client_payload.kimai_version }}"
17 changes: 17 additions & 0 deletions scripts/update-version-number.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

set -e

CONFIG_FILE="_config.yml"

if [ $# -ne 1 ]; then
echo "Usage: $0 <new_value>"
exit 1
fi

new_value="$1"

# Use awk to update the kimai_v2_version value in the CONFIG_FILE
awk -v new_version="$new_value" '/kimai_v2_version:/ {$2 = "\"" new_version "\""} 1' "$CONFIG_FILE" > temp.yml && mv temp.yml "$CONFIG_FILE"

echo "Updated $CONFIG_FILE: Set kimai_v2_version to '$new_value'"

0 comments on commit 7fddf37

Please sign in to comment.