Skip to content

Commit

Permalink
Merge pull request #9 from datarootsio/ci-publish
Browse files Browse the repository at this point in the history
Implement CI pipeline for publishing new versions
  • Loading branch information
murilo-cunha authored Jan 11, 2022
2 parents 5c11b2d + 31f8c57 commit fbd4b0e
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 58 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/docs.yml

This file was deleted.

93 changes: 93 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: 'publish'
on:
push:
branches:
- main

jobs:
get-new-tag:
runs-on: ubuntu-latest
outputs:
tag-id: ${{ steps.git-version.outputs.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }} # checkout the correct branch name
fetch-depth: 0 # fetch the whole repo history
- name: Git Version
uses: codacy/[email protected]
id: git-version
with:
release-branch: main

publish:
runs-on: ubuntu-latest
needs: get-new-tag
env:
POETRY_VERSION: 1.1.7
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies and bump version
run: |
pip install poetry==${{ env.POETRY_VERSION }}
poetry install
poetry version ${{ needs.get-new-tag.outputs.tag-id }}
- name: Configure PiPy, version and build
run: |
poetry config pypi-token.pypi ${{ secrets.PIPY_TOKEN }}
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.TEST_PIPY_TOKEN }}
poetry build
- name: Publish packages
run: |
poetry publish -r test-pypi
poetry publish
- name: Tag and release
uses: actions/github-script@v5
with:
github-token: ${{ github.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ needs.get-new-tag.outputs.tag-id }}",
sha: context.sha
})
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "${{ needs.get-new-tag.outputs.tag-id }}",
generate_release_notes: true
})
docs:
runs-on: ubuntu-latest
needs: [get-new-tag, publish]
env:
POETRY_VERSION: 1.1.7
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install poetry==${{ env.POETRY_VERSION }}
poetry install
- name: Configure git user
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Create coverage report
run: poetry run pytest --cov-report html --cov=databooks tests/
- name: Deploy docs
run: |
poetry run mike deploy --push --update-aliases ${{ needs.get-new-tag.outputs.tag-id }} latest
poetry run mike set-default --push latest
9 changes: 2 additions & 7 deletions .github/workflows/test.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: 'test'
on:
push:
pull_request:
types: [opened]
branches:
- main
name: 'tests'
on: [push]

jobs:
tests:
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yaml → mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ nav:
copyright: 'Maintained by dataroots'

extra:
version:
provider: mike
social:
- icon: fontawesome/brands/github-alt
link: 'https://github.com/datarootsio'
Expand Down
71 changes: 54 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
[tool.poetry]
name = "databooks"
version = "0.1.0"
description = """
Databooks - set of helpers to ease collaboration of data scientists using Jupyter
Notebooks. Easily resolve git conflicts and remove metadata to reduce the number of
conflicts.
"""
version = "0.1.0" # dynamically set in CI
description = "A CLI tool to resolve git conflicts and remove metadata in notebooks."
authors = ["Murilo Cunha <[email protected]>"]
license = "MIT"
readme = "README.md"
Expand All @@ -25,7 +21,7 @@ typer = "^0.3.2"
rich = "^10.6.0"
pydantic = "^1.8.2"
GitPython = "^3.1.24"
mkdocs-coverage = "^0.2.4"


[tool.poetry.dev-dependencies]
black = "^21.7b0"
Expand All @@ -40,6 +36,8 @@ mypy = "^0.910"
mkdocstrings = "^0.16.2"
mkdocs-material = "^8.0.5"
mkdocs-autorefs = "^0.3.0"
mkdocs-coverage = "^0.2.4"
mike = "^1.1.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit fbd4b0e

Please sign in to comment.