GitHub (AIK)
This template uses Github Actions and ships with Astro Integration Kit. Copy it locally by running the following command:
pnpm dlx giget@latest gh:florian-lefebvre/astro-integration-template/templates/github-kit my-integration
Prerequisites
Make sure you have a GitHub and NPM account.
Setup
-
Search for
TODO:
and update them. -
Update all occurrences of
package-name
with your package name. -
Update .changeset/config.json with your organization’s repository name (org/repo-name).
-
Add a
LICENSE
at the root (if you do it through GitHub interface, you’ll be able to see all licenses and pick the best one for your project). -
Pick the right NPM tags, see official docs.
-
Setup your GitHub repository.
-
Generate a classic automation NPM token (
NPM_TOKEN
). -
Generate a classic GitHub personal access token with
repo
scope (COMMIT_TOKEN
) -
Store those secrets on GitHub:
-
Go to your GitHub repository.
-
Navigate to Settings > Secrets and variables > Actions.
-
Click New repository secret and add
NPM_TOKEN
. -
Click New repository secret and add
COMMIT_TOKEN
.
-
Good practises
- Start working on your integration logic.
- Write some docs, either in the README or as a standalone docs website (not included in the template).
- Write good JSDoc annotations.
- Format and lint with
pnpm lint:fix
.
Releasing
This template uses the GitHub Action for Changesets to automatically open a Pull Request to release a package. Once this Pull Request is merged, the package will be published to NPM.
-
Add a changeset and add a meaningful message:
Terminal window pnpm changesetYou can write several changesets if applicable.
-
Commit and push:
Terminal window git add .git commit -m "chore: changeset"git push -
The Changesets GitHub Action will automatically create a Pull Request for the release.
-
Review and merge the release Pull Request. Ensure you’re ready to publish the changes before merging.
-
The package will be published to NPM automatically using the
NPM_TOKEN
stored in your GitHub secrets.