diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9277383..d2fb24a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,6 +22,7 @@ jobs: run: | pip install -r requirements.txt pip install -r dev-requirements.txt + pip install . - name: run tests run: python -m pytest tests/ @@ -45,13 +46,61 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install -r dev-requirements.txt + pip install . - name: install semantic-release run: npm install @semantic-release/exec - name: run semantic release - run: + run: | + nextRelease="`npx semantic-release --dryRun | grep -oP 'Published release \K.*? ' || true`" npx semantic-release + echo "::set-output name=tag::$nextRelease" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PYPI_USERNAME: ${{ secrets.POLLINATION_PYPI_USERNAME }} PYPI_PASSWORD: ${{ secrets.POLLINATION_PYPI_PASSWORD }} + + outputs: + tag: ${{ steps.new_release.outputs.tag }} + + deploy-to-staging: + name: Deploy to Pollination Staging + runs-on: ubuntu-latest + needs: deploy + if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'pollination' && contains(needs.deploy.outputs.tag, '.') }} + steps: + - uses: actions/checkout@v2 + - name: set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: install python dependencies + run: | + pip install -r requirements.txt + pip install . + - name: deploy to staging + run: | + pollination dsl push pollination-honeybee-radiance --tag ${{needs.deploy.outputs.tag}} -e https://api.staging.pollination.cloud + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + QB_POLLINATION_TOKEN: ${{ secrets.POLLINATION_STAGING_LADYBUGBOT_TOKEN }} + + deploy-to-production: + name: Deploy to Pollination Production + runs-on: ubuntu-latest + needs: test + if: github.ref == 'refs/heads/production' && github.repository_owner == 'pollination' + steps: + - uses: actions/checkout@v2 + - name: set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: install python dependencies + run: pip install pollination-honeybee-radiance + - name: deploy to production + run: | + pollination dsl push pollination-honeybee-radiance -e https://api.pollination.cloud + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + QB_POLLINATION_TOKEN: ${{ secrets.POLLINATION_LADYBUGBOT_TOKEN }} diff --git a/requirements.txt b/requirements.txt index 304833c..f680b4b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pollination-dsl==0.8.1 -honeybee-radiance==1.29.2 +pollination-dsl==0.8.7 +honeybee-radiance==1.29.8 diff --git a/setup.py b/setup.py index d75793c..b2f8848 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,15 @@ #!/usr/bin/env python import setuptools # add these line to integrate the queenbee packaging process into Python packaging -from pollination_dsl.package import PostInstall, PostDevelop +try: + from pollination_dsl.package import PostInstall, PostDevelop +except ModuleNotFoundError as error: + if 'No module named' in error and 'pollination_dsl' in error: + # this is the case for the first time install pollination_dsl hasn't been + # installed yet + pass + raise ModuleNotFoundError(error) + with open("README.md", "r") as fh: long_description = fh.read()