GitHub
Overview
With Knapsack, you can leverage GitHub’s extensive ecosystem, including integration with GitHub Actions for CI/CD, advanced code review features, and seamless repository management. GitHub’s user-friendly interface and powerful API make it a great choice for teams of all sizes.
Cloud Authoring
To enable Cloud Authoring with GitHub, you need to install and configure our GitHub App.
Important Steps
Step 1: Install the GitHub App
Ensure the GitHub App is installed for your Knapsack repository. This step is crucial for enabling seamless integration and functionality.
Step 2: Configure the App
Properly configure the app to authenticate and interact with your repository. This ensures smooth pull request submissions and code merging.
Permissions Required
Please note that you must have the necessary GitHub Organization permissions to install and configure the app. Without these permissions, you will not be able to complete the setup.
By following these steps, you can fully leverage Cloud Authoring capabilities with GitHub, streamlining your development workflow.
For any questions or further assistance, please reach out to our team.
GitHub Actions
Required Repository Secrets
Deployments to Heroku rely on the following repository secrets:
HEROKU_EMAIL— The email associated with the Heroku account.HEROKU_API_KEY— The API Key associated with the Heroku account (found in profile settings)HEROKU_GIT_URL— Located on the app dashboard within Heroku’s admin interface
Example main.yml
Deploy Job
The deploy job is responsible for deploying the application to Heroku. It only runs when changes are pushed to the main branch. This job depends on the successful completion of the build job. Here are the steps involved:
- Checkout Repository: Uses the
actions/checkout@v2action to fetch the entire repository history with a fetch depth of 0. This is required for deployment. - Write Authentication: Writes Heroku authentication details to the
.netrcfile to allow Git to authenticate with Heroku using the provided secrets (HEROKU_EMAILandHEROKU_API_KEY). - Push to Heroku: Adds Heroku as a Git remote and pushes the
mainbranch to Heroku for deployment.
Build & Release Job
The build job handles the build and release process of the application. This job runs on every push to the main branch. Here are the steps involved:
- Checkout Repository: Uses the
actions/checkout@v2action to fetch the entire repository history with a fetch depth of 0. This ensures all branches and tags are available. - Set Up Node.js: Sets up Node.js version 18 using the
actions/setup-node@v1action. - Handle Cache: Uses the
actions/cache@v2action to cachenode_modulesand yarn cache directories to speed up subsequent builds. The cache key is based on theyarn.lockfile hash. - Install Dependencies: Installs the project dependencies using Yarn if the cache is not hit. It skips downloading the Cypress binary to speed up the CI process.
- Run Full Build: Builds the application by running
yarn build. - Run Tests: Executes the test suite using
yarn test. - Release: Releases the application using
yarn auto shipit, which creates a release on GitHub. This step uses theGH_TOKENsecret for authentication with GitHub.