Skip to content

Commit

Permalink
Tweak release workflow for more testing (#43)
Browse files Browse the repository at this point in the history
* Update README.md about publish

* Updated workflow files
  • Loading branch information
chrisli30 authored Aug 22, 2023
1 parent c35050e commit 6865b98
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/npm-publish-dev.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Publish dev version

on:
workflow_dispatch
workflow_run:
workflows: ["Publish dev version"]
types:
- manual

jobs:
publish-dev-versions:
publish-dev-version:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
Expand All @@ -22,11 +25,17 @@ jobs:
- name: 🛠️ Build
run: npm run build

- name: 🔐 Authenticate with NPM
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTOMATION_TOKEN_CHRIS }}" > ~/.npmrc

- name: Publish packages to NPM with dev tag
id: changesets
uses: changesets/action@v1
with:
publish: npm run changeset:publish-dev
env:
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN_CHRIS }}
run: |
for dir in packages/*; do
if [ -d "$dir" ]; then
echo "Publishing $dir package"
cd "$dir"
npm publish --tag dev
cd ..
fi
done
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ jobs:
run: npm ci --ignore-scripts

- name: Create Release Pull Request
uses: changesets/action@v1
uses: changesets/action@v2
with:
version: npm run changeset:version
title: Changeset Version Bump
commit: Update the version of packages with .changeset md files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,10 @@ npm run build
The build command will generate distribution files under `packages/api-augment/build`.

## Publishing the Packages
Note: Only the @oak-network developer team on [npmjs.com](https://www.npmjs.com/) has the rights to publish new versions.

Run the following command to publish the packages:

```bash
npm run publish -- <publish_version> <2fa_code>
```

- The first parameter, `<publish_version>`, should match the OAK-blockchain code version. If the version string is like `1.9.0-rc.1`, it will be tagged with `rc` when uploaded to npm.
- The second parameter, `<2fa_code>`, is the Two-Factor Authenticator code of your npmjs.com account, which is enforced when joining the @oak-network team.
The release creation and publish is completely handled by Github Actions.
1. In order to trigger a version update, you need to run `npm run changeset` locally to generate a new version number and a Release Changelog. The script will create a .md file under .changeset like this PR, https://github.com/OAK-Foundation/oak.js/commit/c35050eb16bb73251fb05dd9010ab577f2adf5d6.
2. Once the above PR is merged to main, an Action will be triggered to update all package versions automatically, as seen in this PR, https://github.com/OAK-Foundation/oak.js/pull/42.
3. If things look good, merge the above PR created by changeset, and run the **Publish dev version** workflow manually to publish an NPM package version with `dev` tag for testing.
4. If testing goes well, run the **Make dev version latest** workflow manually to update the npm tag of `dev` to `latest`.

You should receive an email from `support@npmjs.com` if the package is successfully published.

0 comments on commit 6865b98

Please sign in to comment.