From 359e2beab826702a2d98afd34f6a3601a76bb505 Mon Sep 17 00:00:00 2001 From: Matthew Haines-Young Date: Fri, 18 Nov 2022 11:58:43 +0000 Subject: [PATCH] Github npm publish action + Instructions --- .github/actions/publish-to-npm/action.yml | 18 ++++++++++++++++++ CONTRIBUTING.md | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 .github/actions/publish-to-npm/action.yml diff --git a/.github/actions/publish-to-npm/action.yml b/.github/actions/publish-to-npm/action.yml new file mode 100644 index 0000000..4956cf6 --- /dev/null +++ b/.github/actions/publish-to-npm/action.yml @@ -0,0 +1,18 @@ +name: Publish to npm +on: + push: + tags: + - v*.*.* +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-node + with: + cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }} + - run: npm install + - run: npm run build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.npm_token }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0da700a..42f07a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,6 +6,13 @@ Human Made - Block Editor Components - Contribution Guide * Open a pull request against [`humanmade/block-editor-components`](https://github.com/humanmade/block-editor-components) * Pull requests should be reviewed and merged by an engineer at Human Made. +## Releasing a new version. + +* Check out `main` locally and check you are synced with origin. `git checkout main & git reset origin/main --hard` +* Run `npm version major|minor|patch`, adjusting as necessary depending on the type of release. +* `git push -u origin/new-release --tags` +* Once the new tag is shared, a github action will build and publish to npm automatically. + ## Local development. You can contribute to this project whilst working on a project that is using it by using [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link).