Git Integration¶
Warning
Project Glide only works for TypeScript at this time, but support for other languages is coming soon!
Starting from Scratch¶
We have a public template you can clone or use for reference if you’re starting a new project.
Please follow the steps in that repository’s readme file: https://github.com/polyapi/poly-glide-template-js?tab=readme-ov-file#getting-started to get setup.
Starting from Existing Project¶
If you’ve already started a poly project, or have an existing TypeScript project you want to integrate Poly and the Glide workflow with, there’s just a few steps you need to take to integrate Poly with Git.
To enable the Glide workflow you need:
- Git-managed repository hosted on Github.
Follow instructions from Github to setup a new github repository: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository.
Follow instructions from Github to authenticate with Github via the command line: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-authentication-to-github#authenticating-with-the-command-line.
- Pre-commit and post-merge hooks setup to run Poly commands.
Run the following in your terminal from within your project.
$ npm install --save-dev husky
Copy the pre-commit and post-merge hooks from our template project
.husky
into your ownyour_repo/.husky
directory: https://github.com/polyapi/poly-glide-template-js/tree/main/.husky.Commit these changes to git.
- A simple github action that will deploy to Poly.
- Add the following secret variables defined within your github organization or within your github repository:
POLY_API_KEY
- Your key to your instance of PolyAPI.POLY_API_BASE_URL
- The base url to your instance of PolyAPI, ex.https://na1.polyapi.io
for north american cloud users.
Copy the following and save it as
your_repo/.github/workflows/deploy.yml
:name: Deploy to PolyAPI on: push: branches: - main concurrency: group: ${{ github.ref }} cancel-in-progress: true jobs: deploy: runs-on: ubuntu-latest steps: - name: Poly Deploy uses: polyapi/poly-deployment-action-js@v0.2.13-alpha with: poly_api_key: ${{ secrets.POLY_API_KEY }} poly_api_base_url: ${{ secrets.POLY_API_BASE_URL }}
Commit these changes to git.