diff --git a/.github/workflows/publish-package.yaml b/.github/workflows/publish-package.yaml index c8c2fa93..e2c74f1c 100644 --- a/.github/workflows/publish-package.yaml +++ b/.github/workflows/publish-package.yaml @@ -69,14 +69,13 @@ jobs: echo "The core-sdk and react-sdk versions to be published are the same as the latest versions on NPM. " exit 1 fi - echo "$(needs.fetch_latest_version.outputs.core_sdk_latest_version != needs.print_version_to_publish.outputs.core_sdk_version_to_be_published || needs.fetch_latest_version.outputs.react_sdk_latest_version != needs.print_version_to_publish.outputs.react_sdk_version_to_be_published) && github.event_name == 'push'"" - build-test: + build-test-publish: needs: [print_version_to_publish, fetch_latest_version, fail_if_version_is_same] # Skip this job if the version to be published is the same as the latest version on NPM # and the event triggering the workflow is a push - if: ${{ (needs.fetch_latest_version.outputs.core_sdk_latest_version != needs.print_version_to_publish.outputs.core_sdk_version_to_be_published || needs.fetch_latest_version.outputs.react_sdk_latest_version != needs.print_version_to_publish.outputs.react_sdk_version_to_be_published) && github.event_name == 'push'}} + if: ${{ ((needs.fetch_latest_version.outputs.core_sdk_latest_version != needs.print_version_to_publish.outputs.core_sdk_version_to_be_published) || (needs.fetch_latest_version.outputs.react_sdk_latest_version != needs.print_version_to_publish.outputs.react_sdk_version_to_be_published)) && github.event_name == 'push'}} runs-on: ubuntu-latest environment: "beta-sepolia" env: @@ -130,36 +129,36 @@ jobs: - name: Build run: pnpm build - publish-core-sdk: - needs: - [print_version_to_publish, fetch_latest_version, fail_if_version_is_same] - # Skip this job if the version to be published is the same as the latest version on NPM - # and the event triggering the workflow is a push - if: ${{ needs.fetch_latest_version.outputs.core_sdk_latest_version != needs.print_version_to_publish.outputs.core_sdk_version_to_be_published && github.event_name == 'push'}} - runs-on: ubuntu-latest - steps: - - name: Publish to npm + - name: Publish core-sdk package to npm + if: ${{ needs.fetch_latest_version.outputs.core_sdk_latest_version != needs.print_version_to_publish.outputs.core_sdk_version_to_be_published && github.event_name == 'push'}} run: | cd packages/core-sdk npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - create_release-core-sdk: - needs: - [print_version_to_publish, fetch_latest_version, fail_if_version_is_same] + - name: Publish react-sdk package to npm + if: ${{ needs.fetch_latest_version.outputs.react_sdk_latest_version != needs.print_version_to_publish.outputs.react_sdk_version_to_be_published && github.event_name == 'push'}} + run: | + cd packages/react-sdk + npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + create-release-core-sdk: + needs: [build-test-publish, print_version_to_publish, fetch_latest_version] # Skip this job if the version to be published is the same as the latest version on NPM # and the event triggering the workflow is a push - if: needs.fetch_latest_version.outputs.core_sdk_latest_version != needs.print_version_to_publish.outputs.core_sdk_version_to_be_published && github.event_name == 'push' + if: ${{ needs.fetch_latest_version.outputs.core_sdk_latest_version != needs.print_version_to_publish.outputs.core_sdk_version_to_be_published && github.event_name == 'push'}} uses: storyprotocol/gha-workflows/.github/workflows/reusable-create-release.yml@main with: version_to_publish: ${{ needs.print_version_to_publish.outputs.core_sdk_version_to_be_published }} send_slack_notif-core-sdk: - needs: [build-test, create_release-core-sdk] + needs: [build-test-publish, create-release-core-sdk] uses: storyprotocol/gha-workflows/.github/workflows/reusable-slack-notifs.yml@main with: - short-desc: "${{ github.repository }}: Core-sdk package has been published to NPM Registry, version: ${{ needs.print_version_to_publish.outputs.core_sdk_version_to_be_published }}" + short-desc: "${{ github.repository }}: Core-sdk package has been published to NPM Registry, version: ${{ needs.print_version_to_publish.outputs.core_sdk_version_to_be_published}}" title: "Published to Registry" img-url: "https://i.imgur.com/JHmKB0s.png" img-alt-text: "Published to Registry" @@ -167,33 +166,17 @@ jobs: channel-name: ${{ secrets.SLACK_CHANNEL_ID_STORY_57BLOCKS }} slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} - publish-react-sdk: - needs: - [print_version_to_publish, fetch_latest_version, fail_if_version_is_same] - # Skip this job if the version to be published is the same as the latest version on NPM - # and the event triggering the workflow is a push - if: ${{ needs.fetch_latest_version.outputs.react_sdk_latest_version != needs.print_version_to_publish.outputs.react_sdk_version_to_be_published && github.event_name == 'push'}} - runs-on: ubuntu-latest - steps: - - name: Publish to npm - run: | - cd packages/react-sdk - npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - create_release-react-sdk: - needs: - [print_version_to_publish, fetch_latest_version, fail_if_version_is_same] - # Skip this job if the version to be published is the same as the latest version on NPM - # and the event triggering the workflow is a push - if: needs.fetch_latest_version.outputs.react_sdk_latest_version != needs.print_version_to_publish.outputs.react_sdk_version_to_be_published && github.event_name == 'push' - uses: storyprotocol/gha-workflows/.github/workflows/reusable-create-release.yml@main - with: - version_to_publish: ${{ needs.print_version_to_publish.outputs.react_sdk_version_to_be_published }} + # create-release-react-sdk: + # needs: [build-test-publish, print_version_to_publish, fetch_latest_version] + # # Skip this job if the version to be published is the same as the latest version on NPM + # # and the event triggering the workflow is a push + # if: ${{ needs.fetch_latest_version.outputs.react_sdk_latest_version != needs.print_version_to_publish.outputs.react_sdk_version_to_be_published && github.event_name == 'push' }} + # uses: storyprotocol/gha-workflows/.github/workflows/reusable-create-release.yml@main + # with: + # version_to_publish: ${{ needs.print_version_to_publish.outputs.react_sdk_version_to_be_published }} send_slack_notif-react-sdk: - needs: [build-test, create_release-react-sdk] + needs: [build-test-publish] uses: storyprotocol/gha-workflows/.github/workflows/reusable-slack-notifs.yml@main with: short-desc: "${{ github.repository }}: React-sdk package has been published to NPM Registry, version: ${{ needs.print_version_to_publish.outputs.react_sdk_version_to_be_published }}"