Skip to content

A GitHub Action for automating CI/CD processes on a specified server. This action changes directories, activates virtual environments, updates git repositories, installs dependencies, runs database migrations, and reloads web applications.

License

Notifications You must be signed in to change notification settings

umuttopalak/pythonanywhere-deploy-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pythonanywhere-deploy-action

GitHub action to reload a Django Backend webapp on pythonanywhere. The service pythonanywhere can host web apps based on Python (i.e. Django, Flask, ...). The web app can be updated by copying files to the server with various technologies (i.e. Git, SSH, ...) but afterwards the web app has to be restarted manually. Otherwise the web app is not updated.

In order to enable a continuous deployment to pythonanywhere, this GitHub action automatically updates your pythonanywhere web app with the help of their API.

Note

The pythonanywhere API is currently in beta state. Because of that it is possible that the action might not work anymore after a change in the API interface.

Usage

- name: Re-Deploy Pythonanywhere Django API
        uses: umuttopalak/pythonanywhere-deploy-action@v1.0.0
        with:
          host: <pythonanywhere host>
          username: <your-username>
          api_token: <pythonanywhere-api-token>
          domain_name: <pythonanywhere-web-app-domain>
          console_id: <pythonanywhere-bash-id>
          virtual_env: <python-env-which-is-you-created> 
          directory: <project-path-where-you-clone-repository>

Get API token

In order to get the API token you have

Login into your pythonanywhere account. Navigate to Account. Click on section API token. Generate an API token and save it. Do not directly paste your api token or other sensitive data in your workflow xml. Create GitHub action secrets and reference those secrets in your workflow xml.

Example

name: Deploy pythonanywhere webapp
on: [push]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Re-Deploy Pythonanywhere Django API
        uses: umuttopalak/pythonanywhere-deploy-action@v1.0.0
        with:
          host: 'www.pythonanywhere.com' or 'www.eu.pythonanywhere.com'
          username: {{ secrets.USERNAME }}
          api_token: {{ secrets.API_TOKEN }}
          domain_name: {{ secrets.DOMAIN_NAME }}
          console_id:  {{ secrets.CONSOLE_ID }}
          virtual_env: {{ secrets.VIRTUAL_ENV }}
          directory: {{ secrets.DIRECTORY }}

License

MIT: See LICENSE for detailed license information.

About

A GitHub Action for automating CI/CD processes on a specified server. This action changes directories, activates virtual environments, updates git repositories, installs dependencies, runs database migrations, and reloads web applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published