diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml new file mode 100644 index 0000000..3c607ab --- /dev/null +++ b/.github/workflows/manual_release.yml @@ -0,0 +1,12 @@ +name: Publish on Manual Release +on: + release: + types: [created] +jobs: + released: + runs-on: ubuntu-latest + if: contains(github.event.release.author.login, 'rentpath-jenkins') == false && contains(github.event.release.author.login, 'rentpath-semantic-release') == false + steps: + - name: trigger build + run: | + curl -X POST -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/dispatches -d '{"event_type":"semantic-release","client_payload":{"ref":"${{ github.ref }}","sha":"${{ github.sha }}"}}' diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml new file mode 100644 index 0000000..1ded79b --- /dev/null +++ b/.github/workflows/merge.yml @@ -0,0 +1,12 @@ +name: Merging +on: + pull_request: + types: [closed] +jobs: + merged: + if: github.event.pull_request.merged == true + runs-on: 'ubuntu-latest' + steps: + - name: trigger build + run: | + curl -X POST -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/dispatches -d '{"event_type":"semantic-release","client_payload":{"ref":"${{ github.ref }}","sha":"${{ github.sha }}"}}' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ce43683 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish Package +on: + repository_dispatch: + types: [semantic-release] +jobs: + publish: + runs-on: 'ubuntu-latest' + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.client_payload.ref }} + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + registry-url: 'https://npm.pkg.github.com/' + scope: '@rentpath' + - name: install dependencies + run: | + yarn config set @rentpath:registry https://npm.pkg.github.com + yarn install --ignore-scripts + env: + NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: safely run post-install scripts + run: npm rebuild && npm run prepare --if-present + - name: build + run: yarn build + - name: publish + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/README.md b/README.md index 19fe11a..da3eec6 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,11 @@ while useful in some cases, it is considered a bad pattern to block updates to c we should avoid blocking updates to a component directly. you should avoid using this props when you can and focus on creating lighter connected components that do not update so agressively instead. + +## Releasing + +1. Inside your pull request, bump the semantic version in `package.json` +2. Merge the pull request +3. Wait for the GitHub Actions [workflow](https://github.com/rentpath/actions) to publish your new package [here](https://github.com/rentpath/react-redux-router/packages). + +Note: You can also manually [draft a release](https://github.com/rentpath/react-redux-router/releases/new) to set off the package publishing workflow. \ No newline at end of file diff --git a/package.json b/package.json index cb041ab..0827b81 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,9 @@ "react-redux": "^7.1.0", "redux": "^4.0.1" }, + "publishConfig": { + "registry": "https://npm.pkg.github.com/" + }, "engines": { "node": ">=11.9.0" }