Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add a workflow for releasing, candidate or GA #147

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Changesets
on:
workflow_dispatch:
inputs:
level:
description: 'Release type'
required: true
default: 'preview'
type: choice
options:
- preview
- general availability
env:
CI: true
PNPM_CACHE_FOLDER: .pnpm-store
jobs:
version:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: setup node.js
uses: actions/setup-node@v3
with:
node-version: 14
- name: install pnpm
run: npm i pnpm@latest -g
- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How/where is this secret defined please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a secret defined for the action, that can be at repository or organization level. https://docs.github.com/en/actions/security-guides/encrypted-secrets

- name: setup pnpm config
run: pnpm config set store-dir $PNPM_CACHE_FOLDER
- name: install dependencies
run: pnpm install
- name: set pre-release
if: ${{ inputs.level }} == 'preview'
run: pnpm changeset pre enter rc
- name: create and publish versions
uses: changesets/action@v1
with:
version: pnpm ci:version
commit: "chore: update versions"
title: "chore: update versions"
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? If so, how is this token defined please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a secret provided by github which allows actions to do actions against the repository, such as creating pull requests or pushing code. https://docs.github.com/en/actions/security-guides/automatic-token-authentication

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,14 @@ This monorepo uses [pnpm](https://pnpm.io/), make sure to install it first if yo
## License

Dual licensed under [MIT](LICENSE-MIT) and [Apache 2](LICENSE-APACHE)

## Releasing

To perform a release, you must first generate a changeset. Create a branch, e.g. `chore-release`, and then generate your
changeset

pnpm changeset

Commit this changeset, push the branch, and then merge the branch.

Once merged, run the release action. Choose `pre-release` or `release` depending on whether the release is a preview release
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"test:ci": "turbo run test:ci",
"lint": "turbo run lint",
"build": "pnpm --filter \"@composedb/*\" build:types && turbo run build:js",
"prepare": "pnpm build"
"prepare": "pnpm build",
"ci:version": "pnpm changeset version",
"ci:publish": "pnpm publish -r"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
Expand Down