Skip to content

Commit

Permalink
Add a Wpup_Version::VERSION constant and a workflow for automatically…
Browse files Browse the repository at this point in the history
… updating it.

Prompted by #129. Workflow needs testing.
  • Loading branch information
YahnisElsts committed Dec 9, 2024
1 parent 39d0040 commit c873080
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Version File Management
on:
release:
types: [published]

jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Update Version File
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "<?php
class Wpup_Version {
public const VERSION = '$VERSION';
}" > includes/Version.php
- name: Commit Version Update
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add includes/Version.php
git commit -m "chore: Update version to ${GITHUB_REF#refs/tags/v}"
git push
4 changes: 4 additions & 0 deletions includes/Version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
class Wpup_Version {
const VERSION = '2.0.1';
}
1 change: 1 addition & 0 deletions loader.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
require_once __DIR__ . '/includes/Version.php';
require_once __DIR__ . '/includes/Wpup/Package.php';
require_once __DIR__ . '/includes/Wpup/ZipMetadataParser.php';
require_once __DIR__ . '/includes/Wpup/InvalidPackageException.php';
Expand Down

0 comments on commit c873080

Please sign in to comment.