-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(github): add continuous integration and deployment workflows
Introduced new GitHub Actions workflows for continuous integration and deployment. The `CI` workflow is triggered on push to the main branch and pull requests, focusing on build, lint, and test sequences. The `Publish` workflow handles deployment to both private and public npm registries upon tagging and includes steps to create GitHub releases. These workflows are designed to improve the automation and reliability of code integration and deployment processes.
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: CI | ||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "packages/**" | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
name: Continuous Integration & Deployment to Private Registry | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 9.x | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: "pnpm" | ||
registry-url: "https://registry.npmjs.org/" | ||
|
||
# --- Install, build, and test. | ||
- run: pnpm install | ||
- run: pnpm build | ||
- run: pnpm lint:ci | ||
- run: pnpm test:ci | ||
|
||
# --- Publish to private registry on main branch. | ||
# - if: github.event_name == 'push' | ||
# run: pnpm publish:ci --registry https://npm.hsjm.dev --tag next | ||
# env: | ||
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN_PRIVATE}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Publish | ||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
deploy: | ||
name: Deployment to Private Registry & NPM | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 9.x | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: "pnpm" | ||
registry-url: "https://registry.npmjs.org/" | ||
|
||
# --- Install, build, and test. | ||
- run: pnpm install | ||
- run: pnpm build | ||
- run: pnpm lint:ci | ||
- run: pnpm test:ci | ||
|
||
# --- Publish to private registry on main branch. | ||
# - run: pnpm publish:ci --registry https://npm.hsjm.dev --tag latest | ||
# env: | ||
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN_PRIVATE}} | ||
|
||
# --- Publish to NPM registry on main branch. (Only on tags) | ||
- run: pnpm publish:ci --registry https://registry.npmjs.org --tag latest | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
NPM_CONFIG_PROVENANCE: true | ||
|
||
# --- If all goes well, create a release on GitHub. | ||
- run: npx changelogithub --no-group | ||
continue-on-error: true | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |