[Profile] Github stats update #79
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: | |
- 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 }} |