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 7632116
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @djandries @remusao
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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 --force origin HEAD:update-crate
gh pr create --title "Update crate" --body "This PR updates the crate and bumps the minor version." --base master --head update-crate
2 changes: 1 addition & 1 deletion generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cp ./miracl-core/rust/config64.py .
mv ./Cargo.toml ./Cargo.toml.bak

# select bn254 curve in config
echo -e "28\n0\n" | python3 ./config64.py
echo -e "99\n28\n0\n" | python3 ./config64.py

rm ./*.rs ./*.py
mv ./mcore/src/ .
Expand Down

0 comments on commit 7632116

Please sign in to comment.