diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..6c8606b0 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,37 @@ +name: publish +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +on: + workflow_dispatch: + secrets: + NPM_TOKEN: + required: false +jobs: + publish: + name: Bump package versions and publish to npm. + environment: CI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: ./.github/actions/setup + + - id: create_token + uses: tibdex/github-app-token@v2 + with: + app_id: ${{ vars.GH_APP_ID }} + private_key: ${{ secrets.GH_APP_PRIVATE_KEY }} + + - name: Create Release Pull or publish changes + uses: changesets/action@v1 + with: + commit: "chore: bump package versions" + publish: pnpm run release + title: "[Changesets] Bump package versions" + env: + GITHUB_TOKEN: ${{ steps.create_token.outputs.token }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/docs/introduction.md b/docs/introduction.md index f6faa677..fbea9533 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -2,5 +2,6 @@ Welcome to the developer docs. -- [Testing docs](./testing/index.md). +- [Release docs](./release.md). - [Setup docs](./setup.md). +- [Testing docs](./testing/index.md). diff --git a/docs/release.md b/docs/release.md new file mode 100644 index 00000000..a34a146a --- /dev/null +++ b/docs/release.md @@ -0,0 +1,14 @@ +# Release + +Manually releasing all the packages of a monorepo can be as challenging as inappropriate. For such a reason we rely on changesets, GH actions and as less as possible manual steps. + +## Requirements + +- Privileges to trigger GH actions. +- Proper changesets to be deployed. + +## Steps + +### Publish npm packages + +Run the `publish` GH action. This should generate a PR with version bumps and changelogs updates. After carefully reviewing the PR, merge it and run the `publish` action again, passing an `NPM_TOKEN` with privileges to publish in the `@inversifyjs` npm org. This should trigger an attempt to publish npm packages and generate github releases