Skip to content

Volunteer Edit!

Volunteer Edit! #57

Workflow file for this run

name: πŸš€ Deploy
on:
push:
branches:
- develop
- main
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: write
contents: read
jobs:
lint:
name: ⬣ PYLint
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: 🐍 Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: πŸ“₯ Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: πŸ”¬ Lint
run: |
source venv/bin/activate
pylint -E api/*.py
tests:
name: πŸ§ͺ Tests
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: 🐍 Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: πŸ“₯ Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: πŸ„ Copy test env vars
run: cp .env.example .env
#- name: πŸ§ͺ Run tests
# run: |
# source venv/bin/activate
# pytest api/certificates/tests/test_always_pass.py
#- name: πŸ“Š Upload test results
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: test-results
# path: ./test-results/
# retention-days: 30
deploy:
name: πŸš€ Deploy
runs-on: ubuntu-latest
needs: [lint, tests]
# only build/deploy main branch on pushes
if:
${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') &&
github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: πŸ‘€ Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: 'fly.toml'
field: 'app'
- name: πŸš€ Deploy Dev to https://staging.yourapp.com/
if: ${{ github.ref == 'refs/heads/develop' }}
uses: superfly/[email protected]
with:
args:
'deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }}-staging'
env:
FLY_API_TOKEN: ${{ secrets.FLY_STAGING_API_TOKEN }}
- name: πŸš€ Deploy Main to https://yourapp.com/
if: ${{ github.ref == 'refs/heads/main' }}
uses: superfly/[email protected]
with:
args:
'deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }}-prod'
env:
FLY_API_TOKEN: ${{ secrets.FLY_RELEASE_API_TOKEN }}