Skip to content

Instantly share code, notes, and snippets.

@twyle
Created May 30, 2022 17:10
Show Gist options
  • Save twyle/bc8364d519b8f79ba9c57d49879b6dac to your computer and use it in GitHub Desktop.
Save twyle/bc8364d519b8f79ba9c57d49879b6dac to your computer and use it in GitHub Desktop.
name: "Staging Build"
on:
push:
branches: [ staging ]
pull_request:
branches: [ staging ]
env:
APP_NAME: staging-oauth
jobs:
Build:
runs-on: ubuntu-latest
environment:
name: Staging
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
touch .env
echo FLASK_APP=${{secrets.FLASK_APP}} >> .env
echo FLASK_ENV=${{secrets.FLASK_ENV}} >> .env
echo CLIENT_ID=${{secrets.CLIENT_ID}} >> .env
echo CLIENT_SECRET=${{secrets.CLIENT_SECRET}} >> .env
if [ -d tests ] || [ -d test ]; then python -m pytest; fi
DeployStaging:
name: Deploy to Dev
needs: [Build]
runs-on: ubuntu-latest
environment:
name: Development
url: 'https://${{env.APP_NAME}}-staging.herokuapp.com/'
steps:
- name: Deploy
run: echo I am deploying ${{ env.APP_NAME }} at https://${{env.APP_NAME}}-staging.herokuapp.com/
- uses: actions/checkout@v2
- uses: akhileshns/[email protected] # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "${{ env.APP_NAME }}-dev" #Must be unique in Heroku
heroku_email: "${{ secrets.HEROKU_EMAIL }}"
env:
HD_FLASK_ENV: ${{secrets.FLASK_ENV}}
HD_FLASK_APP: ${{secrets.FLASK_APP}}
HD_SECRET_ID: ${{secrets.SECRET_ID}}
HD_SECRET_KEY: ${{secrets.SECRET_KEY}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment