Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
33dc907
Create bump-version-from-tag.yml
Piloalucard Mar 4, 2026
a412fc7
Revert "Create bump-version-from-tag.yml"
Piloalucard Mar 4, 2026
5dd7a6d
Create update-version.yml
Piloalucard Mar 4, 2026
91cd0b2
Update update-version.yml
Piloalucard Mar 4, 2026
c9ae68c
Update version to 2.4.8.2 from upstream tag v2.4.8.2-10520
github-actions[bot] Mar 4, 2026
6547b62
Change name and commit test
Piloalucard Mar 4, 2026
a4d78c1
Merge branch 'chore/automatize-init-version' of https://github.com/Pi…
Piloalucard Mar 4, 2026
3bf8ad7
Revert "Update version to 2.4.8.2 from upstream tag v2.4.8.2-10520"
Piloalucard Mar 4, 2026
dd35678
Update update-version.yml
Piloalucard Mar 4, 2026
69fb111
Update update-version.yml
Piloalucard Mar 4, 2026
3bf638e
Update version to 2.4.8.2 from upstream tag v2.4.8.2-10520
github-actions[bot] Mar 4, 2026
07989bc
Updated name
Piloalucard Mar 4, 2026
f6d300a
Extract build num too
Piloalucard Mar 4, 2026
ada5cc2
chore: sync configure.ac version to 2.4.8.2 (10520) (upstream: v2.4.8…
github-actions[bot] Mar 4, 2026
ab19f88
Update update-version.yml
Piloalucard Mar 4, 2026
3b577f4
Update configure.ac
Piloalucard Mar 4, 2026
f8b23b3
chore: sync configure.ac version to 2.4.8.2 (10520) (upstream: v2.4.8…
github-actions[bot] Mar 4, 2026
fb5d158
New apporach
Piloalucard Mar 5, 2026
46a1405
Update version-bump-prelim.yml
Piloalucard Mar 5, 2026
6862bd9
Re-doing
Piloalucard Mar 5, 2026
fde1a5a
chore: update version to 2.4.8.3 (Prelim)
github-actions[bot] Mar 5, 2026
b28ecec
Delete version-bump-prelim.yml
Piloalucard Mar 5, 2026
e7c2043
Merge branch 'chore/automatize-init-version' of https://github.com/Pi…
Piloalucard Mar 5, 2026
9c14d83
release-tag
Piloalucard Mar 5, 2026
fe94a8d
Test, this should trigger to change to prelim automatically
Piloalucard Mar 5, 2026
3f29aba
chore: update version to 2.4.8.4 (Prelim)
github-actions[bot] Mar 5, 2026
07232fe
Test, no change because already prelim
Piloalucard Mar 5, 2026
2de313d
release-tag
Piloalucard Mar 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Sync LTFS Version with Upstream

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-version:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch latest tag from upstream
id: get_tag
run: |
# Fetch the latest tag from the upstream repository
LATEST_TAG=$(curl -s https://api.github.com/repos/LinearTapeFileSystem/ltfs/tags | jq -r '.[0].name')
echo "Latest tag from upstream: $LATEST_TAG"

# Extract version numbers and build number (e.g., v.2.4.8.2-10520 -> 2.4.8.2 (10520))
VERSION_NUM=$(echo "$LATEST_TAG" | sed -E 's/^v\.?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/')
BUILD_NUM=$(echo "$LATEST_TAG" | sed -E 's/^v\.?[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+-([0-9]+).*/\1/')

# Combine version with build number
if [ -n "$BUILD_NUM" ] && [ "$BUILD_NUM" != "$LATEST_TAG" ]; then
VERSION="$VERSION_NUM ($BUILD_NUM)"
else
VERSION="$VERSION_NUM"
fi

echo "Extracted version: $VERSION"

# Store in output
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Check current version in configure.ac
id: check_version
run: |
# Extract current version from line 39
CURRENT_VERSION=$(sed -n '39p' configure.ac | sed -E 's/.*\[LTFS\], \[([^]]+)\].*/\1/')
echo "Current version in configure.ac: $CURRENT_VERSION"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT

# Check if commit message contains "release-tag"
COMMIT_MSG=$(git log -1 --pretty=%B)
echo "Latest commit message: $COMMIT_MSG"

if echo "$COMMIT_MSG" | grep -q "release-tag"; then
echo "Commit contains 'release-tag' keyword - skipping update"
echo "needs_update=false" >> $GITHUB_OUTPUT
exit 0
fi

# Extract the value inside parentheses from current version
PAREN_VALUE=$(echo "$CURRENT_VERSION" | sed -E 's/.*\(([^)]+)\).*/\1/')
echo "Value in parentheses: $PAREN_VALUE"

# Check if the value in parentheses is a number
if ! echo "$PAREN_VALUE" | grep -qE '^[0-9]+$'; then
echo "Value in parentheses is not a number (likely 'Prelim') - no update needed"
echo "needs_update=false" >> $GITHUB_OUTPUT
exit 0
fi

echo "Value in parentheses is a number - proceeding with update"

# Extract version number without parentheses (e.g., "2.4.8.2" from "2.4.8.2 (10520)")
VERSION_BASE=$(echo "$CURRENT_VERSION" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/')
echo "Base version: $VERSION_BASE"

# Increment the last number in the version
LAST_NUM=$(echo "$VERSION_BASE" | awk -F. '{print $NF}')
NEW_LAST_NUM=$((LAST_NUM + 1))
NEW_VERSION=$(echo "$VERSION_BASE" | sed -E "s/\.[0-9]+$/.$NEW_LAST_NUM/")
NEW_VERSION_WITH_PRELIM="$NEW_VERSION (Prelim)"

echo "New version: $NEW_VERSION_WITH_PRELIM"
echo "new_version=$NEW_VERSION_WITH_PRELIM" >> $GITHUB_OUTPUT
echo "needs_update=true" >> $GITHUB_OUTPUT

- name: Update configure.ac
if: steps.check_version.outputs.needs_update == 'true'
id: update_file
run: |
VERSION="${{ steps.check_version.outputs.new_version }}"

# Update line 39 with the new version
sed -i "39s/\[LTFS\], \[[^]]*\]/[LTFS], [$VERSION]/" configure.ac

echo "File updated successfully"
echo "Updated line 39:"
sed -n '39p' configure.ac

- name: Commit and push changes
if: steps.check_version.outputs.needs_update == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

git add configure.ac
git commit -m "chore: update version to ${{ steps.check_version.outputs.new_version }}"
git push origin HEAD:${{ github.event.pull_request.head.ref }}

- name: Summary
run: |
echo "## Version Check Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Upstream Tag**: ${{ steps.get_tag.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
echo "- **Upstream Version**: ${{ steps.get_tag.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "- **Current Version**: ${{ steps.check_version.outputs.current_version }}" >> $GITHUB_STEP_SUMMARY
echo "- **Update Needed**: ${{ steps.check_version.outputs.needs_update }}" >> $GITHUB_STEP_SUMMARY

if [ "${{ steps.check_version.outputs.needs_update }}" == "true" ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "**configure.ac updated** - Version changed from ${{ steps.check_version.outputs.current_version }} to ${{ steps.check_version.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY
else
echo "" >> $GITHUB_STEP_SUMMARY
echo "**No update needed** - Version already has 'Prelim' or commit contains 'release-tag'" >> $GITHUB_STEP_SUMMARY
fi

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
dnl
dnl LTFS configure.ac.
dnl
AC_INIT([LTFS], [2.4.5.1 (Prelim)], IBM corporation.)
AC_INIT([LTFS], [2.4.8.2 (10520)], IBM corporation.)
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
Expand Down
Loading