diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..dabfd80 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,74 @@ +name: Publish to PyPI + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' # Matches semantic versioning tags + - '[0-9]+.[0-9]+.[0-9]+-test.*' # Test releases + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.12'] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies and run CI + run: | + python -m pip install --upgrade pip + pip install build pytest pytest-cov setuptools_scm + make ci + + publish: + needs: test + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Verify tag version matches package version + run: | + python -m pip install --upgrade pip + pip install build pytest pytest-cov setuptools_scm twine + PACKAGE_VERSION=$(python -m setuptools_scm) + TAG_VERSION=${GITHUB_REF#refs/tags/} # Remove 'refs/tags/' prefix + if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then + echo "Package version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)" + exit 1 + fi + + - name: Publish to TestPyPI + if: contains(github.ref, 'test') + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} + run: make all && twine upload --repository testpypi dist/* + + - name: Publish to PyPI + if: "!contains(github.ref, 'test')" + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: make dist + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index db627a6..b6fba03 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .PHONY: all dist d clean c version v install i test t build b -all: clean install test build version +ci: clean install test +all: ci build version dist d: all scripts/check-version.sh diff --git a/README.md b/README.md index 4daeab2..e594511 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [](https://github.com/psf/black) [](https://www.gnu.org/licenses/agpl-3.0) -`CEDARScript Editor (Python)` is a [CEDARScript](https://github.com/CEDARScript/cedarscript-grammar#readme) runtime +`CEDARScript Editor (Python)` is a [CEDARScript](https://bit.ly/cedarscript) runtime for interpreting `CEDARScript` scripts and performing code analysis and modification operations on a codebase. CEDARScript enables offloading _low-level code syntax and structure concerns_, such as indentation and line counting, diff --git a/pyproject.toml b/pyproject.toml index 704d16d..479924b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ ] keywords = ["cedarscript", "code-editing", "refactoring", "code-analysis", "sql-like", "ai-assisted-development"] dependencies = [ - "cedarscript-ast-parser>=0.5.4", + "cedarscript-ast-parser>=0.5.6", "grep-ast==0.3.3", # https://github.com/tree-sitter/py-tree-sitter/issues/303 # https://github.com/grantjenks/py-tree-sitter-languages/issues/64
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: