-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up an automated workflow for playground deployment (GH-40)
- Loading branch information
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: playground | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
jobs: | ||
deploy: | ||
environment: | ||
name: Playground | ||
url: https://playground.pysnippet.org/fastapi-oauth2 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run deployment script on server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.KEY_ED25519 }} | ||
port: ${{ secrets.PORT }} | ||
script: sh ~/fastapi-oauth2/examples/demonstration/deploy.sh |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
cd ~/fastapi-oauth2/ | ||
git restore . | ||
git pull | ||
|
||
cd ~/fastapi-oauth2/examples/demonstration | ||
echo "import main; from fastapi import FastAPI; app = FastAPI(); app.mount('/fastapi-oauth2', main.app)" > playground.py | ||
|
||
sudo rm -r /var/www/playground/fastapi-oauth2/ | ||
sudo cp -r ~/fastapi-oauth2/examples/demonstration /var/www/playground/fastapi-oauth2/ | ||
sudo python3 -m pip install -r /var/www/playground/fastapi-oauth2/requirements.txt | ||
|
||
# Update environment variables for production | ||
ENV_FILE=/var/www/playground/fastapi-oauth2/.env | ||
for ENV_KEY in OAUTH2_GITHUB_CLIENT_ID OAUTH2_GITHUB_CLIENT_SECRET OAUTH2_GOOGLE_CLIENT_ID OAUTH2_GOOGLE_CLIENT_SECRET; | ||
do | ||
sudo python3 -c "from dotenv import set_key; set_key('${ENV_FILE}', '${ENV_KEY}', '${!ENV_KEY}')"; | ||
done | ||
|
||
sudo service playground.fastapi-oauth2 restart |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
fastapi | ||
httpx>=0.23.0 | ||
oauthlib>=3.2.2 | ||
python-jose>=3.3.0 | ||
social-auth-core>=4.4.2 | ||
starlette>=0.19.1 | ||
sqlalchemy | ||
python-dotenv | ||
fastapi-oauth2 |