add environment config #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy | |
on: | |
push: | |
branches: | |
- lendemor/deploy_pipeline | |
jobs: | |
setup-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
folders: ${{ steps.generate-matrix.outputs.folders }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate Matrix | |
id: generate-matrix | |
run: | | |
FOLDERS=$(ls -d */ | sed 's|/||g' | jq -R -s -c 'split("\n")[:-1]') | |
echo "folders=$FOLDERS" >> $GITHUB_OUTPUT | |
- name: Debug output (matrix) | |
run: | | |
echo "Subfolders: ${{ env.folders }}" | |
deploy: | |
needs: setup-matrix | |
runs-on: ubuntu-latest | |
environment: Cloud Deploy | |
strategy: | |
matrix: | |
folder: ${{fromJson(needs.setup-matrix.outputs.folders)}} | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
pip install -r ${{ matrix.folder }}/requirements.txt | |
- name: Set environment dynamically | |
id: set-env | |
run: | | |
case ${{ matrix.folder }} in | |
ai_image_gen) | |
echo "EXTRA_ENV=--env REPLICATE_API_TOKEN=${{ secrets.REPLICATE_API_TOKEN }}" >> $GITHUB_ENV | |
;; | |
*) | |
echo "EXTRA_ENV=" >> $GITHUB_ENV | |
;; | |
esac | |
- name: Deploy to ReflexCloud | |
env: | |
REFLEX_AUTH_TOKEN: ${{ secrets.REFLEX_AUTH_TOKEN }} | |
run: | | |
chmod +x deploy.sh | |
./deploy.sh ${{ matrix.folder }} "$EXTRA_ENV" |