Skip to content

Commit

Permalink
[github] adding conditionals on deployment (#445)
Browse files Browse the repository at this point in the history
* adding conditionals on deployment

* adding swarm condition
  • Loading branch information
diegoarceof authored Oct 31, 2024
1 parent 15323a7 commit 97950f3
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 49 deletions.
52 changes: 28 additions & 24 deletions .github/workflows/apps-devel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,38 @@ jobs:
devel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: '3.10'

- name: Install Hal9
run: pip install hal9
- name: Deploy Echo
run: hal9 deploy apps/echo --name ECHO --access public --url https://api.devel.hal9.com --title Echo --description "Echoes user input"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN_DEVEL }}
- name: Deploy Hal9
run: hal9 deploy apps/hal9 --name hal9 --access public --url https://api.devel.hal9.com --title Hal9 --description "Conversations and content creation"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN_DEVEL }}
- name: Deploy flux
run: hal9 deploy apps/flux --name flux --access public --url https://api.devel.hal9.com --title Flux --description "Photorealistic content creation"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN_DEVEL }}
- name: Deploy Browser
run: hal9 deploy apps/browser --name browser --access unlisted --url https://api.devel.hal9.com --title Browser --description "Capable of browsing the web"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN_DEVEL }}
- name: Deploy OpenAI
run: hal9 deploy apps/openai --name openai --access public --url https://api.devel.hal9.com --title OpenAI --description "Makes use of OpenAI O1"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN_DEVEL }}
- name: Deploy Swarm
run: hal9 deploy apps/swarm --name swarm --access public --url https://api.devel.hal9.com --title Swarm --description "Makes use of OpenAI Swarm"

- uses: actions/checkout@v1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
since_last_remote_commit: true

- name: Deploy changed apps
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN_DEVEL }}
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN_DEVEL }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
if [[ "$file" == apps/flux/* ]]; then
hal9 deploy apps/flux --name flux --access public --url https://api.devel.hal9.com --title Flux --description "Photorealistic content creation"
elif [[ "$file" == apps/echo/* ]]; then
hal9 deploy apps/echo --name ECHO --access public --url https://api.devel.hal9.com --title Echo --description "Echoes user input"
elif [[ "$file" == apps/hal9/* ]]; then
hal9 deploy apps/hal9 --name hal9 --access public --url https://api.devel.hal9.com --title Hal9 --description "Conversations and content creation"
elif [[ "$file" == apps/browser/* ]]; then
hal9 deploy apps/browser --name browser --access unlisted --url https://api.devel.hal9.com --title Browser --description "Capable of browsing the web"
elif [[ "$file" == apps/openai/* ]]; then
hal9 deploy apps/openai --name openai --access public --url https://api.devel.hal9.com --title OpenAI --description "Makes use of OpenAI O1"
elif [[ "$file" == apps/swarm/* ]]; then
hal9 deploy apps/swarm --name swarm --access public --url https://api.devel.hal9.com --title Swarm --description "Makes use of OpenAI Swarm"
done
54 changes: 29 additions & 25 deletions .github/workflows/apps-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,41 @@ on:
- apps/**

jobs:
prod:
devel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: '3.10'

- name: Install Hal9
run: pip install hal9
- name: Deploy Echo
run: hal9 deploy apps/echo --name ECHO --access public --title Echo --description "Echoes user input"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN }}
- name: Deploy Hal9
run: hal9 deploy apps/hal9 --name hal9 --access public --title Hal9 --description "Conversations and content creation"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN }}
- name: Deploy Flux
run: hal9 deploy apps/flux --name flux --access public --title Flux --description "Photorealistic content creation"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN }}
- name: Deploy Browser
run: hal9 deploy apps/browser --name browser --access unlisted --title Browser --description "Capable of browsing the web"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN }}
- name: Deploy OpenAI
run: hal9 deploy apps/openai --name openai --access public --title OpenAI --description "Makes use of OpenAI O1"
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN }}
- name: Deploy Swarm
run: hal9 deploy apps/swarm --name swarm --access public --title Swarm --description "Makes use of OpenAI Swarm"
- uses: actions/checkout@v1

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
since_last_remote_commit: true

- name: Deploy changed apps
env:
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN }}
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
HAL9_TOKEN: ${{ secrets.HAL9_TOKEN_DEVEL }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
if [[ "$file" == apps/flux/* ]]; then
hal9 deploy apps/flux --name flux --access public --url https://api.devel.hal9.com --title Flux --description "Photorealistic content creation"
elif [[ "$file" == apps/echo/* ]]; then
hal9 deploy apps/echo --name ECHO --access public --url https://api.devel.hal9.com --title Echo --description "Echoes user input"
elif [[ "$file" == apps/hal9/* ]]; then
hal9 deploy apps/hal9 --name hal9 --access public --url https://api.devel.hal9.com --title Hal9 --description "Conversations and content creation"
elif [[ "$file" == apps/browser/* ]]; then
hal9 deploy apps/browser --name browser --access unlisted --url https://api.devel.hal9.com --title Browser --description "Capable of browsing the web"
elif [[ "$file" == apps/openai/* ]]; then
hal9 deploy apps/openai --name openai --access public --url https://api.devel.hal9.com --title OpenAI --description "Makes use of OpenAI O1"
elif [[ "$file" == apps/swarm/* ]]; then
hal9 deploy apps/swarm --name swarm --access public --url https://api.devel.hal9.com --title Swarm --description "Makes use of OpenAI Swarm"
done

0 comments on commit 97950f3

Please sign in to comment.