diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..92d238b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Publish to PyPI + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + tests: + name: Run tests before publish + uses: ./.github/workflows/reusable_test.yml + secrets: inherit + + build: + name: Build distribution + needs: tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install build tools + run: pip install build + + - name: Build sdist and wheel + run: python -m build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish: + name: Publish to PyPI + needs: build + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index 2e86e7e..2c88410 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "PrivacyGuard" description = "PrivacyGuard platform for Privacy Attacks and Analysis. Perform privacy analyses of ML models using Inference Attacks and Extraction Attacks." authors = [{name = "Meta Platforms, Inc."}] -license = "MIT" +license = "Apache-2.0" license-files = ["LICENSE"] readme = "README.md" requires-python = ">=3.10" @@ -93,9 +93,8 @@ find = {} [tool.setuptools.package-data] "*" = ["*.js", "*.css", "*.html"] -#[tool.setuptools_scm] -#write_to = "privacy_guard/version.py" -#local_scheme = "node-and-date" +[tool.setuptools_scm] +local_scheme = "node-and-date" [tool.usort] first_party_detection = false