diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 7577789..0dab73b 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -1,9 +1,10 @@ name: Build and push docker image on: - push: - branches: - - main + release: + types: + - published + workflow_dispatch: jobs: build-and-push: @@ -20,6 +21,7 @@ jobs: - name: install poetry run: | python -m pip install --no-cache-dir poetry==1.8 supervisor + poetry self add "poetry-dynamic-versioning[plugin]" - name: set up docker run: | @@ -39,9 +41,10 @@ jobs: run: make build-wheel - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . push: true tags: | + ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} ghcr.io/${{ github.repository }}:latest diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml new file mode 100644 index 0000000..6ecc0d4 --- /dev/null +++ b/.github/workflows/conventional-commits.yml @@ -0,0 +1,15 @@ +name: Ensure all PRs have conventional commit titles +on: + pull_request: + types: + - edited + - opened + - synchronize + - reopened + +jobs: + conventional_commit_title: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chanzuckerberg/github-actions/.github/actions/conventional-commits@main \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..f61cc89 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,22 @@ +name: Release Please + +on: + push: + branches: + - main + +jobs: + release: + name: Run release-please + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run release-please + uses: google-github-actions/release-please-action@v3 + with: + release-type: python + token: ${{ secrets.GITHUB_TOKEN }} + bump-minor-pre-major: true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 12ac4c3..85e1459 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,8 @@ RUN apt update && \ COPY requirements.txt . RUN pip install -r requirements.txt -COPY dist/platformics-0.1.0-py3-none-any.whl /tmp/platformics-0.1.0-py3-none-any.whl -RUN cd /tmp/ && pip install platformics-0.1.0-py3-none-any.whl && rm -rf /tmp/*.whl +COPY dist /tmp/dist +RUN cd /tmp/dist && pip install *.whl && rm -rf /tmp/*.whl RUN mkdir -p /app WORKDIR /app diff --git a/README.md b/README.md index bb36e2d..18f3d23 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ The libraries and tools that make Platformics work: ## Roadmap - [ ] Plugin hooks to add business logic to generated GQL resolvers - [ ] Support arbitrary class inheritance hierarchies +- [ ] Package and publish to PyPI ## How to set up your own platformics API 1. Copy the test_app boilerplate code to your own repository. @@ -43,6 +44,9 @@ The libraries and tools that make Platformics work: 4. Browse to http://localhost:9009/graphql to interact with your api! 5. Run `make token` to generate an authorization token that you can use to interact with the API. The `make` target copies the necessary headers to the system clipboard. Paste the token into the `headers` section at the bottom of the GraphQL explorer API +## Versioning platformics +Right now, platformics is used in downstream applications by using the platformics image as the base Docker image. To select a version of platformics, add the appropriate version tags to the docker image. + ## Iterating on your schema 1. Make changes to `schema/schema.yml` 2. Run `make codegen` to re-run code gen and restart the API service diff --git a/pyproject.toml b/pyproject.toml index b6bb969..54b18d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [tool.poetry] name = "platformics" -version = "0.1.0" +# placeholder version that will be replace by poetry-dynamic-versioning +version = "0.0.0" description = "Platformics bio entities framework" authors = ["CZI Infectious Disease Team "] license = "MIT License" @@ -51,8 +52,12 @@ sqlalchemy_utils = "^0.41.1" strawberry-graphql = "^0.217.0" [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["poetry-core", "poetry-dynamic-versioning>=1.0.0,<2.0.0"] +# a wrapper for poetry.core.masonry.api +build-backend = "poetry_dynamic_versioning.backend" + +[tool.poetry-dynamic-versioning] +enable = true [tool.black] line-length = 120