Skip to content

Commit

Permalink
build(ci): automate push to Pollination
Browse files Browse the repository at this point in the history
  • Loading branch information
mostaphaRoudsari committed Feb 4, 2021
1 parent 92223ac commit b4638bf
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
51 changes: 50 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand All @@ -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 }}
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pollination-dsl==0.8.1
honeybee-radiance==1.29.2
pollination-dsl==0.8.7
honeybee-radiance==1.29.8
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down

0 comments on commit b4638bf

Please sign in to comment.