From 1eca8e3a1eebd21290173de91f3fa1717858025e Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 8 Oct 2024 21:34:17 -0400 Subject: [PATCH] 0.3.0: updating actions (#3) * .3.0: updating actions * updated check version string * update pr verfiication --- .github/workflows/pr-validation.yml | 30 +++++++++++++++++++++-------- .github/workflows/publish.yml | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 6ed3ac4..c5ad938 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -16,25 +16,39 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.6' + python-version: '3.x' - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools wheel pip install -r requirements.txt - - name: Get version from version.py + - name: Get version from main branch id: get_version - run: echo "::set-output name=version::$(python -c "import importlib; print(importlib.import_module('src.libcrawler.version').__version__)")" - + run: | + # Extract version from the Python file and store it as a variable + VERSION=$(python -c "import importlib; print(importlib.import_module('src.libcrawler.version').__version__)") + echo "Extracted Version: $VERSION" + + # Prefix the version with 'v' to match the branch naming convention + BRANCH_VERSION="v$VERSION" + echo "Formatted Branch Version: $BRANCH_VERSION" + + # Set the formatted version as an environment variable for later steps + echo "branch_version=$BRANCH_VERSION" >> $GITHUB_ENV + - name: Check if branch exists for the current version run: | - git ls-remote --heads origin refs/heads/${{ steps.get_version.outputs.version }} && exit 1 || true - + # Use the formatted branch version to check if it exists in the repo + git ls-remote --heads origin refs/heads/$branch_version && exit 0 || (echo "Branch $branch_version does not exist" && exit 1) + - name: Run tests run: python -m unittest discover -s src/tests + - name: Build and check distribution + run: python3 -m build sdist + - name: Install package and test entry point run: | - pip install . + pip install dist/*.tar.gz crawl-docs --help \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 989975c..a68cf1b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.6' + python-version: '3.x' - name: Install dependencies run: |