Merge pull request #4 from KWB-R/experimental/plotly-js #35
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 Django Application | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: pip install -r requirements.txt && pip install -r requirements.test.txt | |
- name: Test | |
run: python manage.py test | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
environment: dev | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Declare image's tag | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
- name: Build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: false | |
tags: qmra:${{ env.sha_short }} | |
load: true | |
- name: Save | |
run: docker save qmra > img.tar | |
- name: Push | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: ${{ secrets.DEPLOY_USER }} | |
key: ${{ secrets.DEPLOY_SERVER_SSH_KEY }} | |
source: "img.tar" | |
target: ${{ secrets.DEPLOY_PATH }} | |
- name: Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: ${{ secrets.DEPLOY_USER }} | |
key: ${{ secrets.DEPLOY_SERVER_SSH_KEY }} | |
script: | | |
cd ${{ secrets.DEPLOY_PATH }} && git pull | |
microk8s ctr image import img.tar && rm img.tar | |
cd infra/helm | |
microk8s helm upgrade qmra ./qmra -n qmra --set app_secret_key.value=${{ secrets.APP_SECRET_KEY }},image.tag=${{ env.sha_short }} |