Skip to content

chore: add automated pre-release process #214

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

Merged
merged 1 commit into from
Nov 15, 2021
Merged
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
43 changes: 43 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: prerelease
on:
push:
branches:
# releases/<tag>/<version>
- releases/*/*
jobs:
prerelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '*'
cache: 'npm'
check-latest: true
registry-url: 'https://registry.npmjs.org'
- name: Extract tag and version
id: extract
run: |-
ref=${{ github.ref }}
branch=${ref:11}
tag_version=${branch:9}
tag=${tag_version%/*}
version=${tag_version##*/}
echo "::set-output name=tag::${tag}"
echo "::set-output name=version::${version}"
- name: Log versions
run: |-
echo tag=${{ steps.extract.outputs.tag }}
echo version=${{ steps.extract.outputs.version }}
- name: Setup git user
run: git config --global user.name github-actions
- name: Setup git email
run: git config --global user.email github-actions@github.com
- name: Run npm version
run: npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }}
- name: Push changes
run: git push --follow-tags
- name: Run npm publish
run: npm publish --tag=${{ steps.extract.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ npm test

After submitting the pull request, please make sure the Continuous Integration checks are passing.

### Creating a prerelease

1. Create a branch named `releases/<tag>/<version>` with the version you'd like to release.
2. Push the branch to the repo.

For example, a branch named `releases/rc/4.0.0` will create the version `v4.0.0-rc` and publish it under the `rc` tag.

## Releasing

Merge the release PR