Merge pull request #558 from digitalearthafrica/sandbox-index #64
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
# The name of your workflow. | |
# GitHub displays the names of your workflows on your repository's actions page. | |
name: Publish deafrica-tools to PyPI | |
# Define which events can cause the workflow to run. | |
on: | |
# Triggers the workflow to run when | |
# 1) a push is made to the main branch that includes changes to any file in the `Tools/` | |
# directory except the translation files, | |
# or | |
# 2) by clicking the 'Run workflow' button on the Actions tab. | |
push: | |
branches: | |
- main | |
paths: | |
- 'Tools/**' | |
- '!Tools/deafrica_tools/locales/**' | |
- '!Tools/**/*.po' | |
- '!Tools/**/*.mo' | |
- '!Tools/**/*.pot' | |
workflow_dispatch: | |
# Groups together all the jobs that run in the workflow. | |
# A workflow run is made up of one or more jobs. | |
# Jobs run in parallel by default. | |
jobs: | |
# Job unique identifier. | |
build-n-publish: | |
# Name for the job, which is displayed on GitHub. | |
name: Build and publish deafrica-tools to PyPI | |
# Specifies the runner environment the job will run in. | |
# Configure the job to run on the latest version of an Ubuntu Linux runner. | |
runs-on: ubuntu-latest | |
# Set default working directory for all run steps in the job | |
defaults: | |
run: | |
working-directory: ./Tools | |
# Groups together all the steps that run in the job. | |
# A job contains a sequence of tasks called steps. | |
# Each item nested under this section is a separate action or shell script. | |
steps: | |
# The uses keyword specifies that this step will run v3 of the actions/checkout action. | |
# This is an action that checks out your repository onto the runner (downloads your repository into the CI runner), | |
# allowing you to run scripts or other actions against your code (such as build and test tools). | |
# You should use the checkout action any time your workflow will run against the repository's code. | |
- name: Checkout the digitalearthafrica/deafrica-sandbox-notebooks repository | |
uses: actions/checkout@v3 | |
# This action sets up a Python environment for use in the workflow by installing and activating Python 3.10.6 | |
- name: Set up Python 3.10.6 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10.6" # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified. | |
- name: Install pypa/build | |
run: python3 -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: python3 -m build --sdist --wheel --outdir dist/ . | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages-dir: Tools/dist/ |