From f1c83f8a5f822401dee3742301cde91682da6ad9 Mon Sep 17 00:00:00 2001 From: Emily Zhang Date: Wed, 10 Nov 2021 16:27:47 -0800 Subject: [PATCH] chore: add automated pre-release process --- .github/workflows/pre-release.yml | 43 +++++++++++++++++++++++++++++++ CONTRIBUTING.md | 7 +++++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/pre-release.yml diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 00000000..fdb7449c --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,43 @@ +name: prerelease +on: + push: + branches: + # releases// + - 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}} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59222dbb..ef2bc9fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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//` 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