diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml new file mode 100644 index 00000000..19dbbfd6 --- /dev/null +++ b/.github/workflows/deploy-dev.yml @@ -0,0 +1,56 @@ +name: Pulumi Deploy +on: + push: + branches: + - develop +jobs: + preview: + name: Preview + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-region: ${{ secrets.AWS_REGION }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + - name: Install AWS CLI + run: | + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + unzip awscliv2.zip + sudo ./aws/install + + # Retrieve and set environment variables from AWS Secrets Manager + - name: Retrieve secrets from AWS Secrets Manager + run: | + aws secretsmanager get-secret-value --secret-id opengpts-env-variables --query 'SecretString' --output text | jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' > .env + more .env + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + + # Create and activate the virtual environment + - name: Set up Python virtual environment + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install --upgrade pip + pip install -r requirements.txt + + # Update the Pulumi stack + - uses: pulumi/actions@v5 + with: + command: up + stack-name: brighthive/bb-assistants-dev + env: + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} diff --git a/.github/workflows/preview-dev.yml b/.github/workflows/preview-dev.yml new file mode 100644 index 00000000..e60388a6 --- /dev/null +++ b/.github/workflows/preview-dev.yml @@ -0,0 +1,37 @@ +name: Pulumi Preview +on: + pull_request: +jobs: + preview: + name: Preview + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-region: ${{ secrets.AWS_REGION }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + # Create and activate the virtual environment + - name: Set up Python virtual environment + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install --upgrade pip + pip install -r requirements.txt + + - uses: pulumi/actions@v5 + with: + command: preview + stack-name: brighthive/bb-assistants-dev + env: + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..fdcbc618 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +pulumi>=3.0.0,<4.0.0 +pulumi-random>=4.0.0,<5.0.0 +pulumi-aws +pulumi-docker +python-dotenv \ No newline at end of file