From de005c365233983f45300b67d41f97cb6533c6fa Mon Sep 17 00:00:00 2001 From: Mohamed Abuelanin Date: Sun, 20 Oct 2024 18:07:10 -0700 Subject: [PATCH] organize --- .github/workflows/CI.yaml | 60 +++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 64 ---------------------------------- src/snipe/__init__.py | 2 +- 3 files changed, 61 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index eac3c2f..fc9a180 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -75,3 +75,63 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs/site publish_branch: gh-pages + + release: + if: contains(github.event.head_commit.message, 'make-a-release') + runs-on: ubuntu-latest + name: Release ${{ github.event.head_commit.id }} + needs: test + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install hatch twine + + - name: Extract Version from __init__.py + id: extract_version + run: | + VERSION=$(python -c "import re; + import pathlib; + init_file = pathlib.Path('src/snipe/__init__.py'); + content = init_file.read_text(); + match = re.search(r'__version__\s*=\s*[\'\"]([^\'\"]+)[\'\"]', content); + print(match.group(1) if match else '0.0.0')") + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Build package + run: | + hatch build + + - name: Upload to PyPI Test Server + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} + run: | + python -m pip install twine + twine upload --repository-url https://test.pypi.org/legacy/ dist/* + + - name: Create Git Tag + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}" + git push origin "v${{ env.VERSION }}" + + - name: Create GitHub Release + uses: ncipollo/release-action@v1 + with: + tag: "v${{ env.VERSION }}" + name: "v${{ env.VERSION }}" + body: | + Release version ${{ env.VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 4c5faff..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: Release - -on: - push: - branches: - - main - -jobs: - release: - if: contains(github.event.head_commit.message, 'make-a-release') - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install hatch twine - - - name: Extract Version from __init__.py - id: extract_version - run: | - VERSION=$(python -c "import re; - import pathlib; - init_file = pathlib.Path('src/snipe/__init__.py'); - content = init_file.read_text(); - match = re.search(r'__version__\s*=\s*[\'\"]([^\'\"]+)[\'\"]', content); - print(match.group(1) if match else '0.0.0')") - echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Build package - run: | - hatch build - - - name: Upload to PyPI Test Server - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} - run: | - python -m pip install twine - twine upload --repository-url https://test.pypi.org/legacy/ dist/* - - - name: Create Git Tag - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}" - git push origin "v${{ env.VERSION }}" - - - name: Create GitHub Release - uses: ncipollo/release-action@v1 - with: - tag: "v${{ env.VERSION }}" - name: "v${{ env.VERSION }}" - body: | - Release version ${{ env.VERSION }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/snipe/__init__.py b/src/snipe/__init__.py index a09f420..ab24bb2 100644 --- a/src/snipe/__init__.py +++ b/src/snipe/__init__.py @@ -3,4 +3,4 @@ from snipe.api.multisig_reference_QC import MultiSigReferenceQC from snipe.api.reference_QC import ReferenceQC -__version__ = '0.1.1' \ No newline at end of file +__version__ = '0.1.2' \ No newline at end of file