Skip to content

Add environment variables to github actions yaml file and some example #4

Add environment variables to github actions yaml file and some example

Add environment variables to github actions yaml file and some example #4

Workflow file for this run

name: Build and Deploy Code
on: [push, pull_request]
env:
SECRET_KEY: 9b68c9f53ff13f75b890b62af1d9435d65827796d21ceb16c5fe431f054dcde3
ALGORITHM: HS256
ACCESS_TOKEN_EXPIRE_MINUTES: 60
jobs:
my_first_job:
env:
DATABASE_HOSTNAME: localhost
DATABASE_PORT: 5432
DATABASE_PASSWORD: 1234
DATABASE_NAME: social_media_fastapi
DATABASE_USERNAME: postgres
runs-on: ubuntu-20.04
steps:
- name: Pulling Git Repo
uses: actions/checkout@v4
- name: Install Python version 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests with PyTest
run: |
pip install pytest
pytest -v
my_second_job:
runs-on: ubuntu-20.04
steps:
- name: Second job that has access to global env
run: |
echo SECRET_KEY
echo DATABASE_HOSTNAME