Skip to content

trigger-update-toml-version #111

trigger-update-toml-version

trigger-update-toml-version #111

name: Update version in TOML files
on:
repository_dispatch:
types: [ trigger-update-toml-version ]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
modify_files:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- name: Update version in TOML files
env:
GH_TOKEN: ${{ github.token }}
run: |
# Extract the current version from the TOML file
CURRENT_VERSION=$(awk -F '"' '/^version/ {print $2}' llama-cpp-2/Cargo.toml)
# Increment the version
NEXT_VERSION=$(echo "$CURRENT_VERSION" | awk -F. -v OFS=. '{++$NF; print}')
# Update version in llama-cpp-sys-2 Cargo.toml
sed -i "s/^version = \".*\"/version = \"$NEXT_VERSION\"/g" llama-cpp-sys-2/Cargo.toml
# Update version in llama-cpp-2 Cargo.toml
sed -i "s/^version = \".*\"/version = \"$NEXT_VERSION\"/g" llama-cpp-2/Cargo.toml
sed -i "s/^\(llama-cpp-sys-2 = { path = \"\.\.\/llama-cpp-sys-2\", version = \)\"$CURRENT_VERSION\"/\1\"$NEXT_VERSION\"/" llama-cpp-2/Cargo.toml
# Update the version in the simple Cargo.toml
sed -i "s/^version = \".*\"/version = \"$NEXT_VERSION\"/g" examples/simple/Cargo.toml
sed -i "s/^\(llama-cpp-2 = { path = \"\.\.\/llama-cpp-2\", version = \)\"$CURRENT_VERSION\"/\1\"$NEXT_VERSION\"/" examples/simple/Cargo.toml
# Update the version in the root embeddings Cargo.toml
sed -i "s/^version = \".*\"/version = \"$NEXT_VERSION\"/g" examples/embeddings/Cargo.toml
sed -i "s/^\(llama-cpp-2 = { path = \"\.\.\/llama-cpp-2\", version = \)\"$CURRENT_VERSION\"/\1\"$NEXT_VERSION\"/" examples/embeddings/Cargo.toml
# Update Cargo.lock by running cargo check
cargo check
# Commit the changes
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git add llama-cpp-sys-2/Cargo.toml llama-cpp-2/Cargo.toml examples/simple/Cargo.toml examples/embeddings/Cargo.toml Cargo.lock
git commit -m "Bump version to $NEXT_VERSION [skip ci]"
# Create a branch for the changes
git checkout -b version-bump-$NEXT_VERSION
# Push the changes and create a pull request
git push origin version-bump-$NEXT_VERSION --force
gh pr create --base main --head version-bump-$NEXT_VERSION --title "Bumped version to $NEXT_VERSION" --fill
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy