Skip to content

- Enhanced performance of functions. #34

- Enhanced performance of functions.

- Enhanced performance of functions. #34

Workflow file for this run

name: Release miunlock
on:
push:
paths:
- MiUnlockTool.py
pull_request:
paths:
- MiUnlockTool.py
workflow_dispatch:
jobs:
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get version
id: get_version
run: |
version=$(grep -oP '(?<=version = ")(.*)(?=")' MiUnlockTool.py)
echo "VERSION=$version" >> $GITHUB_ENV
- name: tag
run: |
if ! git ls-remote --tags origin | grep -q "$VERSION"; then
git tag "$VERSION"
git push origin "$VERSION"
else
echo "Tag $VERSION already exists, skipping tag creation."
fi
- name: release
run: |
if ! gh release view $VERSION; then
gh release create $VERSION --title "Release $VERSION"
else
echo "Release $VERSION already exists, skipping release creation."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
- name: upload
run: |
if git rev-parse --verify HEAD~1 >/dev/null 2>&1; then
if git diff --name-only HEAD~1 HEAD | grep -q "MiUnlockTool.py"; then
commit_message=$(git log -1 --pretty=format:"%s" -- MiUnlockTool.py)
old_notes=$(gh release view $VERSION --json body -q '.body')
if [ -z "$old_notes" ]; then
notes="$commit_message"
else
if [ "$old_notes" = "$commit_message" ]; then
notes="$commit_message"
else
notes="${old_notes}\n$commit_message"
fi
fi
new_notes=$(echo -e "$notes")
gh release edit $VERSION --notes "$new_notes"
else
echo "MiUnlockTool.py was not modified in the last commit, skipping notes update."
fi
else
echo "No previous commit to compare with."
fi
gh release upload $VERSION ./MiUnlockTool.py --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}