From 481544a52c755991cd56ee8ef3c670c77cbc7381 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Tue, 26 Nov 2024 10:00:27 +0100 Subject: [PATCH 1/3] Add publish worklfow --- .github/workflows/publish-npm.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/publish-npm.yml diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..0dba29f --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,31 @@ +name: Publish Package to npmjs +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: "The version to release. The version should be the same as version in package.json. For example, 1.0.0" + required: true +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'workflow_dispatch' + with: + fetch-tags: true + ref: ${{ inputs.version }} + + - uses: actions/checkout@v4 + if: github.event_name != 'workflow_dispatch' + + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + - run: yarn + - run: yarn publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 645a83cdbb5a386cdc2fd241d15582a234fb3f54 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Tue, 26 Nov 2024 10:01:02 +0100 Subject: [PATCH 2/3] Remove release workflow --- .github/workflows/release.yml | 94 ----------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 4145de8..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Release - -on: - push: - branches: - - "main" - -jobs: - tag: - name: Check and Tag - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - with: - with_initial_version: false - id: get-latest-tag - - - name: Create tag - id: tag - uses: butlerlogic/action-autotag@1.1.2 - with: - tag_prefix: "v" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - outputs: - tag: ${{ steps.tag.outputs.tagname }} - previous_tag: ${{ steps.get-latest-tag.outputs.tag }} - version: ${{ steps.tag.outputs.version }} - - release: - name: Publish - runs-on: ubuntu-latest - needs: tag - if: needs.tag.outputs.tag != '' - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "lts/fermium" - - - run: yarn install - - run: yarn build - - - name: Generate changelog - id: changelog - uses: janheinrichmerker/action-github-changelog-generator@v2.4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - issues: "false" - pullRequests: "true" - prWoLabels: "true" - author: "true" - usernamesAsGithubLogins: "true" - compareLink: "true" - filterByMilestone: "false" - unreleased: "false" - sinceTag: "${{ needs.tag.outputs.previous_tag }}" - maxIssues: "0" - stripGeneratorNotice: "true" - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ needs.tag.outputs.tag }} - body_path: "CHANGELOG.md" - release_name: Release ${{ needs.tag.outputs.tag }} - prerelease: true # we can promote to release trough github - - # From https://github.com/lerna/lerna/issues/2404 - - run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Publish to npm registry - run: yarn publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - # in case of failure - - name: Rollback on failure - if: failure() - uses: author/action-rollback@9ec72a6af74774e00343c6de3e946b0901c23013 - with: - id: ${{ steps.create_release.outputs.id }} - tag: ${{ needs.tag.outputs.tag }} - delete_orphan_tag: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From eef6a8daf1709d0009258b2679644902e21561c6 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Tue, 26 Nov 2024 10:02:41 +0100 Subject: [PATCH 3/3] Bump package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ed79397..2083b5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dapplion/benchmark", - "version": "0.2.4", + "version": "0.2.5", "main": "lib/index.js", "repository": "git@github.com:dapplion/benchmark.git", "author": "dapplion <35266934+dapplion@users.noreply.github.com>",