-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from datarootsio/ci-publish
Implement CI pipeline for publishing new versions
- Loading branch information
Showing
6 changed files
with
156 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
@@ -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" | ||
|
@@ -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"] | ||
|