Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DJAndries committed Jan 29, 2025
1 parent fb447a1 commit 680b3d0
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Update Crate

on:
schedule:
- cron: '0 0 1 */3 *'
workflow_dispatch:

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

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Run generate script
run: |
chmod +x ./generate.sh
./generate.sh
- name: Check for changes
id: git-check
run: |
git diff --exit-code --stat || echo "changes=true" >> $GITHUB_OUTPUT
- name: Bump Cargo.toml minor version
if: steps.git-check.outputs.changes == 'true'
run: |
# Read current version
current_version=$(grep -m1 'version =' Cargo.toml | sed 's/.*= "//' | sed 's/"//')
# Split version into major, minor, patch
IFS='.' read -r major minor patch <<< "$current_version"
# Increment minor version
new_minor=$((minor + 1))
new_version="$major.$new_minor.0"
# Update Cargo.toml
sed -i "s/^version = \".*\"/version = \"$new_version\"/" Cargo.toml
echo "Version bumped from $current_version to $new_version"
- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git add .
git commit -m "Update crate and bump version"
git push origin HEAD:update-crate
gh pr create --title "Update crate" --body "This PR updates the crate and bumps the minor version." --base main --head update-crate
- name: Check PR status
if: steps.git-check.outputs.changes == 'true'
run: |
echo "Pull Request 'Update crate' created successfully!"

0 comments on commit 680b3d0

Please sign in to comment.