feat: add url column to export #145
This file contains hidden or 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 to Scaleway | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: ${{ github.ref_name }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up SSH | |
| uses: webfactory/ssh-agent@v0.5.3 | |
| with: | |
| ssh-private-key: ${{ secrets.SCW_SSH_KEY }} | |
| - name: Deploy to Scaleway | |
| env: | |
| SCW_HOST: ${{ secrets.SCW_HOST }} | |
| SCW_USER: ${{ secrets.SCW_USER }} | |
| run: | | |
| ssh -o StrictHostKeyChecking=no $SCW_USER@$SCW_HOST << 'EOF' | |
| set -e | |
| cd /home/ubuntu/aigle-api || exit 1 | |
| # Fetch latest code | |
| git fetch origin ${{ github.ref_name }} || exit 1 | |
| git reset --hard origin/${{ github.ref_name }} || exit 1 | |
| # Export env vars | |
| set -a | |
| source .env || exit 1 | |
| set +a | |
| # Install packages | |
| xargs -a Aptfile sudo apt install -y || exit 1 | |
| # Start Redis | |
| sudo systemctl start redis-server || exit 1 | |
| sudo systemctl enable redis-server || exit 1 | |
| # Set up services | |
| sudo cp services/celery.service /etc/systemd/system/ || exit 1 | |
| sudo cp services/gunicorn_aigle.service /etc/systemd/system/ || exit 1 | |
| sudo systemctl daemon-reload || exit 1 | |
| sudo systemctl enable celery || exit 1 | |
| sudo systemctl enable gunicorn_aigle || exit 1 | |
| # Set up emails | |
| sudo ufw allow $EMAIL_PORT || exit 1 | |
| # Activate Python env and apply migrations | |
| source venv/bin/activate || exit 1 | |
| python -m pip install -r requirements.txt || exit 1 | |
| python manage.py migrate || exit 1 | |
| # Gracefully reload services | |
| sudo systemctl restart celery || exit 1 | |
| sudo systemctl restart gunicorn_aigle || exit 1 | |
| echo "Deployment completed successfully!" | |
| EOF | |
| # Check SSH command result | |
| if [ $? -ne 0 ]; then | |
| echo "Deployment failed!" | |
| exit 1 | |
| fi |