Skip to content

Commit

Permalink
automate versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
carlHandy committed Jul 18, 2024
1 parent 672f317 commit 334c8d2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/scripts/update-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Get the new version number from the tag
NEW_VERSION=$(echo $GITHUB_REF | cut -d / -f 3)

# Remove the 'v' prefix if present
NEW_VERSION=${NEW_VERSION#v}

# Update the version in main.php
sed -i "s/Version: [0-9.]\+/Version: $NEW_VERSION/" main.php

# Commit the change
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add main.php
git commit -m "Bump version to $NEW_VERSION"

# Push the change
git push
18 changes: 18 additions & 0 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Update Version

on:
push:
tags:
- 'v*'

jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Update version in main.php
run: |
chmod +x .github/scripts/update-version.sh
.github/scripts/update-version.sh

0 comments on commit 334c8d2

Please sign in to comment.