Skip to content

deploy-nightly

deploy-nightly #240

name: deploy-nightly
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "00 6 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
name: Run tests
strategy:
fail-fast: false
matrix:
python-version: ["3.8"]
poetry-version: ["1.5.1"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry ${{ matrix.poetry-version }}
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry==${{ matrix.poetry-version }}
- name: Install dependencies
shell: bash
run: |
python -m poetry install
python -m poetry run python scripts/fetch_core.py
python -m poetry run python scripts/zip_templates.py
- name: Test with pytest
run: |
python -m poetry run pytest -v --cov
deploy:
needs: test
name: Deploy to pypi
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Sets up python3
- uses: actions/setup-python@v4
with:
python-version: 3.8
# Setup poetry
- name: Install poetry 1.5.1
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry==1.5.1
- name: Install dependencies
shell: bash
run: python -m poetry install
- name: Run prep-nightly script and publish if ready
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
echo "Updating core commit and version; building"
output=$(poetry run python scripts/prep_nightly.py)
echo "Finished steps to prep nightly deployment"
if [[ $output == *"Ready to deploy"* ]]; then
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
echo "Published to pypi"
fi