{"id":26949670,"url":"https://github.com/numerous-com/deploy-app-with-github-actions-tutorial","last_synced_at":"2025-04-02T22:17:06.417Z","repository":{"id":256200325,"uuid":"853222276","full_name":"numerous-com/deploy-app-with-github-actions-tutorial","owner":"numerous-com","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-09T12:43:26.000Z","size":918,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-09-09T15:21:58.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numerous-com.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-06T08:21:13.000Z","updated_at":"2024-09-09T12:43:29.000Z","dependencies_parsed_at":"2024-09-09T15:22:06.241Z","dependency_job_id":"d59fd33d-7c2c-497d-afcf-ca7d0ff110b8","html_url":"https://github.com/numerous-com/deploy-app-with-github-actions-tutorial","commit_stats":null,"previous_names":["numerous-com/deploy-app-with-github-actions-tutorial"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numerous-com%2Fdeploy-app-with-github-actions-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numerous-com%2Fdeploy-app-with-github-actions-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numerous-com%2Fdeploy-app-with-github-actions-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numerous-com%2Fdeploy-app-with-github-actions-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numerous-com","download_url":"https://codeload.github.com/numerous-com/deploy-app-with-github-actions-tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246899655,"owners_count":20851899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-02T22:17:05.900Z","updated_at":"2025-04-02T22:17:06.411Z","avatar_url":"https://github.com/numerous-com.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deploying your app with GitHub Actions\n\nIn this tutorial we will show how to set up deployment of an app with\n[GitHub actions](https://github.com/features/actions), so that every push to\nyour GitHub repository will automatically deploy the new version of your app to\nNumerous\n\nIn the repository\n[numerous-com/deploy-app-with-github-actions-tutorial](https://github.com/numerous-com/deploy-app-with-github-actions-tutorial)\nwe have set up the example that we will go through in this tutorial. You can use\nit as a reference for your own repository.\n\n## Clone the repository to your machine\n\nThis tutorial assumes that you have a repository set up on GitHub. First we\neither clone it, or if it is already on the computer, navigate to it in our\nterminal.\n\n## Create a simple app\n\nInside the folder of our repository, we create a very simple app. For this\ntutorial we create a Streamlit app.\n\n```bash\nnumerous init --app-library streamlit\n```\n\nAfter following the wizard, we open `app.py` in our code editor, and\nadd the following content to it.\n\n```python copy\nimport streamlit as st\n\nst.text(\"This app has been deployed with GitHub actions\")\n```\n\nNow the app should be ready to be deployed, we just need to set up the\ndeployment.\n\n## Define the GitHub actions workflow\n\nIn your repository folder create the directory `.github/workflows` and inside\nthat add the file `deploy.yml`, and add the following workflow definition.\n\n```yaml\nname: Deploy\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      # First, we check out the code:\n      - uses: actions/checkout@v4\n\n      # Then we set up python:\n      - uses: actions/setup-python@v5\n        with:\n          python-version: \"3.11\"\n          cache: \"pip\"\n\n      # We install the Numerous SDK, which includes the CLI:\n      - run: pip install numerous\n\n      # And finally we deploy our app, setting the NUMEROUS_ACCESS_TOKEN\n      # environment  variable with the GitHub actions secret that contains the\n      # actual value.\n      # We also insert the app slug and organization slug from secrets.\n      - env:\n          NUMEROUS_ACCESS_TOKEN: ${{secrets.NUMEROUS_ACCESS_TOKEN}}\n        run: numerous deploy --app ${{secrets.APP_SLUG}} --organization ${{secrets.ORGANIZATION_SLUG}}\n```\n\n## Create a personal access token\n\nWe need a personal access token to give the CLI access to run in the GitHub\nactions environment without logging in. Create one with the below command.\n\n```bash copy\nnumerous token create --name github-actions\n```\n\nCopy the token that is printed, so you can add it to a GitHub secret later.\n\n## Finding your organization slug\n\nYou can find your organization slug either in the browser or with the CLI.\n\nUsing the CLI we can run `numerous organization list`, and a list of all your\norganizations will be displayed, which includes. You can also create an organization with\n`numerous organization create` if you do not have one.\n\nIn the browser you can find the organization slug in the address bar, like in the\nscreenshot below.\n\n![](/images/numerous_github_actions_browser_organization_slug.png)\n\n## Add secret values to GitHub actions\n\nIn our workflow file we used the secrets `NUMEROUS_ACCESS_TOKEN`, `APP_SLUG` and\n`ORGANIZATION_SLUG`. We need to define the values for these.\n\n1. Go to the repository **Settings** page.\n   ![](/images/numerous_github_actions_repo_settings.png)\n2. Open the **Secrets and variables** for **Actions** page.\n   ![](/images/numerous_github_actions_repo_settings_actions.png)\n3. Click the button to create a new repository secret.\n   ![](/images/numerous_github_actions_repo_settings_actions_repository_secret.png)\n4. First we add the secret named `NUMEROUS_ACCESS_TOKEN` that we use in the\n   workflow. Add the personal access token that you created earlier as the\n   **Secret**.\n\n   The value in the screenshot is just an example of how it will look like.\n   ![](/images/numerous_github_actions_repo_settings_add_secret_numerous_access_token.png)\n\n5. Now we add the secret named `ORGANIZATION_SLUG` that we use in the\n   workflow. Add the organization slug you found before as the **Secret**.\n   ![](/images/numerous_github_actions_repo_settings_add_secret_organization_slug.png)\n6. Finally, The app slug is user defined. You can select a different value, but it has\n   to be composed of only lowercase alphanumeric characters with dashes as the\n   separator. It will become part of the URL for the app.\n   ![](/images/numerous_github_actions_repo_settings_add_secret_app_slug.png)\n\n## Push your repository\n\nNow commit and push the simple app and the workflow file, and GitHub actions\nshould start a workflow for your repository!\n\n![](/images/numerous_github_actions_workflow_running.png)\n\nAnd when the workflow has completed, the app should be deployed to the specified\norganization and app slug.\n\n![](/images/numerous_github_actions_app_deployed.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumerous-com%2Fdeploy-app-with-github-actions-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumerous-com%2Fdeploy-app-with-github-actions-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumerous-com%2Fdeploy-app-with-github-actions-tutorial/lists"}