To get started, you will need to install the GitHub App. This allows us to detect pull requests, comment on your pull requests with a preview of the change log, update build statuses, and trigger GitHub actions workflows if you use them for releases.
INSTALL CTA GOES HERE
**Selector to choose between GitHub actions and Circel CI, styled somethign like https://twitter.com/steveschoger/status/1024720091546562560/photo/1 **
Create a new file called .github/workflows/rollingversions.yml
. In it, put:
name: Release
on:
repository_dispatch:
types: [rollingversions_publish_approved]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x, 14.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
publish:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- run: npx rollingversions publish --github-token ${{ secrets.GITHUB_TOKEN }}
It's up to you what tests you run, the important thing is that it's triggered by repository_dispatch
of rollingversions_publish_approved
and that it eventually authenticates to npm and runs npx rollingversions publish
- this will publish your release.
Go to your repositories Settings
> Secrets
and add an NPM_TOKEN
with permission to publish all the packages in this repository. You don't need to worry about the GITHUB_TOKEN
as GitHub will generate one for your action automatically.
Edit your README.md
file and add the badge:
[](https://staging.rollingversions.com/YOUR_GITHUB_LOGIN/YOUR_REPOSITORY_NAME)
Next time you submit a pull request, you will be asked to add a change log. Once you've merged the pull request, you can click on the badge in the README and you will be taken to Rolling Versions, where you can preview the release, and approve it to be published (providing you have write or admin access to the GitHub repository).
In your Circle CI config, add a workflow that has a publish-dry-run
and publish
step separated by a publish-approval
step:
workflows:
release:
jobs:
- publish-dry-run:
filters:
branches:
only: master
- publish-approval:
type: approval
requires:
- publish-dry-run
- publish:
requires:
- publish-approval
filters:
branches:
only: master
Add the corresponding jobs:
jobs:
publish-dry-run:
docker:
- image: circleci/node:12
steps:
- checkout
- run: npm install
- run: npm test
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- run: npx rollingversions publish --dry-run
publish:
docker:
- image: circleci/node:12
steps:
- checkout
- run: npm install
- run: npm test
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- run: npx rollingversions publish
The exact job names and steps are up to you. All that is imporatnt is that it authenticates to npm and runs npx rollingversions publish
.
In the settings for this repository on Circle CI, add these environment variables:
GITHUB_TOKEN
- a GitHub personal access token with at least "repo" scope.NPM_TOKEN
- an npm token with permission to publish all the packages in this repo
Next time you submit a pull request, you will be asked to add a change log. Once you've merged the pull request, you can go to the workflow in Circle CI, see the output of the --dry-run
and optionally approve the release to trigger the final part of the workflow - publishing your package.
If your project is in a mono repo, Rolling Versions will still work just fine without any changes, but you can optionally choose to ignore certain packages that should not have versions by adding "@rollingversions/ignore": true
to your package.json. We do exactly that on Rolling Versions itself.