Skip to content

Commit

Permalink
Fixed version update script.
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaskov committed Jun 26, 2024
1 parent 4a1b880 commit a2580d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .github/change_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ patch="${version_number#*.}"
if [[ ${CHANGE_TYPE} == "major" ]]
then
major=$((major+1))
minor=0
patch=0
elif [[ ${CHANGE_TYPE} == "minor" ]]
then
minor=$((minor+1))
patch=0
else
patch=$((patch+1))
fi

new_version_str='version = "'${major}.${minor}.${patch}'"'

echo "Previous version: ${original_version_str}"
echo "New version: ${new_version_str}"

sed -i "s|${original_version_str}|${new_version_str}|g" ${GITHUB_WORKSPACE}/Cargo.toml

13 changes: 5 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ jobs:
app-id: ${{ vars.FAIR_MATH_PUBLISHER_ID }}
private-key: ${{ secrets.FAIR_MATH_PUBLISHER_PRIVATE_KEY }}

- run: |
echo "Change type: $CHANGE_TYPE"
env:
CHANGE_TYPE: ${{ inputs.change_type }}
- name: Checkout sources
uses: actions/checkout@v4
with:
Expand All @@ -45,6 +40,8 @@ jobs:
run: |
chmod +x ${GITHUB_WORKSPACE}/.github/change_version.sh
bash ${GITHUB_WORKSPACE}/.github/change_version.sh
env:
CHANGE_TYPE: ${{ inputs.change_type }}

- name: Pushing Cargo.toml changes to master
run: |
Expand All @@ -53,6 +50,6 @@ jobs:
git commit -am "Automated version change in Cargo.toml [skip actions]"
git push origin master
- run: cargo publish --no-verify --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
# - run: cargo publish --no-verify --token ${CRATES_TOKEN}
# env:
# CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}

0 comments on commit a2580d9

Please sign in to comment.