Skip to content

Commit

Permalink
Merge pull request #141 from relayjs/alloy/add-release-scripts
Browse files Browse the repository at this point in the history
[ci] Add release automation scripts
  • Loading branch information
captbaritone authored Oct 17, 2023
2 parents b463da4 + ef93d45 commit 0fb398b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,31 @@ jobs:
run: yarn run lint
- name: Prettier
run: yarn run prettier-check

release:
name: Publish to NPM
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository == 'relayjs/eslint-plugin-relay'
needs: [build, lint]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'yarn'
- name: Build latest (main) version
if: github.ref == 'refs/heads/main'
run: yarn version --no-git-tag-version --new-version 0.0.0-main-${GITHUB_SHA}
- name: Check release version matches tag
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: |
if [ $(cat package.json | jq -r '.version') != "${GITHUB_REF_NAME:1}" ]; then
echo "Version in package.json does not match tag. Did you forget to commit the package.json version bump?"
exit 1
fi
- name: Publish to npm
if: github.ref == 'refs/heads/main' || github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: npm publish ${TAG}
env:
TAG: ${{ github.ref == 'refs/heads/main' && '--tag=main' || ((contains(github.ref_name, '-rc.') && '--tag=dev') || '' )}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ _Before_ submitting a pull request, please make sure the following is done…
4. Auto-format the code by running `yarn run prettier` or `npm run prettier`.
5. If you haven't already, complete the CLA.

### Package Publishing

- Every change that gets pushed to the `main` branch will be published as `0.0.0-main-SHA`.
- For stable releases, the release author is expected to update the version in `package.json`, commit that, and create an accompanying tag. Once this is pushed a package will be published following that version. The workflow would look something like this:

```bash
$ yarn version --minor
$ git push --follow-tags
```

### Contributor License Agreement (CLA)

In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, just let us know that you have completed the CLA and we can cross-check with your GitHub username.
Expand Down

0 comments on commit 0fb398b

Please sign in to comment.