Skip to content

Commit

Permalink
fix(ci): Add CI and trigger first release
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelkp committed Nov 6, 2024
1 parent d4627d1 commit d49402c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 2 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
name: CI

on: [push]

jobs:
deploy:
name: Deploy to GitHub and PyPI
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.repository_owner == 'pollination'
steps:
- uses: actions/checkout@v2
- name: set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: set up node # we need node for for semantic release
uses: actions/setup-node@v4
with:
node-version: 22.2.0
- name: install python dependencies
run: |
pip install -r dev-requirements.txt
pip install .
- name: install semantic-release
run: npm install @semantic-release/exec
- name: run semantic release
id: new_release
run: |
nextRelease="`npx semantic-release@^23.1.1 --dryRun | grep -oP 'Published release \K.*? ' || true`"
npx semantic-release@^23.1.1
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: Set Tag
id: set-tag
run: |
TAG=$(echo "${{ needs.deploy.outputs.tag }}" | sed 's/[[:space:]]//g')
echo "::set-output name=tag::$TAG"
- name: install python dependencies
run: pip install .
- name: deploy to staging
run: |
queenbee
pollination dsl push pollination-breeam-daylight-4b --tag ${{needs.deploy.outputs.tag}} -e https://api.staging.pollination.cloud -src https://api.staging.pollination.cloud/registries --push-dependencies
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
if: github.ref == 'refs/heads/production' && github.repository_owner == 'pollination'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Get Job Context
id: get-context
run: |
TAG=$(git describe --tags | sed 's/v//')
echo "Releasing tag: ${TAG:?}"
echo "::set-output name=tag::$TAG"
- name: install python dependencies
run: |
pip install pollination-breeam-daylight-4b
pip install -r requirements.txt
- name: deploy to production
run: |
TAG=$(echo "${TAG:?}" | sed 's/[[:space:]]//g')
echo $TAG
queenbee
pollination dsl push pollination-breeam-daylight-4b --tag $TAG -e https://api.pollination.cloud -src https://api.pollination.cloud/registries --push-dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
QB_POLLINATION_TOKEN: ${{ secrets.POLLINATION_LADYBUGBOT_TOKEN }}
TAG: ${{ steps.get-context.outputs.tag }}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pollination-two-phase-daylight-coefficient==1.1.32
pollination-two-phase-daylight-coefficient==1.1.35
pollination-honeybee-radiance-postprocess==0.0.72
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
setup_requires=['setuptools_scm'],
url='https://github.com/pollination/breeam-daylight-4b', # will be translated to home
project_urls={
'icon': 'https://raw.githubusercontent.com/ladybug-tools/artwork/master/icons_components/honeybee/png/leeddaylight.png',
'icon': 'https://raw.githubusercontent.com/ladybug-tools/artwork/master/icons_components/honeybee/png/breeamdaylight4b.png',
'docker': 'https://hub.docker.com/r/ladybugtools/honeybee-radiance'
},
description='BREEAM daylight 4b recipe for Pollination.', # will be used as package description
Expand Down

0 comments on commit d49402c

Please sign in to comment.