Release miunlock #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Create Release and Upload | |
run: | | |
if ! gh release view $VERSION; then | |
gh release create $VERSION --title "Release $VERSION" | |
gh release upload $VERSION ./MiUnlockTool.py --clobber | |
else | |
echo "Release $VERSION already exists, skipping release creation." | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ env.VERSION }} |