Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: publish npm workflow #21

Merged
merged 5 commits into from
Sep 5, 2024
Merged

ci: publish npm workflow #21

merged 5 commits into from
Sep 5, 2024

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Aug 30, 2024

A workflow to publish IDL files on npm. Published when a GitHub release is made.

@fadeev fadeev linked an issue Aug 30, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 9.17%. Comparing base (3bc8dad) to head (bed715c).

Additional details and impacted files
@@          Coverage Diff          @@
##            main     #21   +/-   ##
=====================================
  Coverage   9.17%   9.17%           
=====================================
  Files          1       1           
  Lines        218     218           
=====================================
  Hits          20      20           
  Misses       198     198           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fadeev
Copy link
Member Author

fadeev commented Aug 30, 2024

@zeta-chain/devops can someone, please, create a new npm package:

https://www.npmjs.com/package/@zetachain/protocol-contracts-solana

And add an npm token to this repo. Thanks!

@fadeev fadeev requested a review from gartnera August 31, 2024 01:22
Comment on lines 21 to 24
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

      - name: Install stable
        uses: dtolnay/rust-toolchain@stable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 44 to 54
- name: Determine NPM Tag
id: determine-npm-tag
run: |
VERSION_TAG=${GITHUB_REF#refs/tags/v}
if [[ $VERSION_TAG == *"-"* ]]; then
echo ::set-output name=NPM_TAG::${VERSION_TAG#*-}
else
echo ::set-output name=NPM_TAG::latest
fi
env:
GITHUB_REF: ${{ github.ref }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is deprecated by GitHub, please consider using:

steps:
  - name: Set the foo value
    id: foo_value
    run: |
      echo "foo=bar" >> "$GITHUB_ENV"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, but this has never worked for me. I propose we improve this in a follow-up PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a working example in a workflow on this repository:

        - name: Record Rust version
          run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
        - name: Upload to codecov.io
          uses: codecov/codecov-action@v4
          with:
            fail_ci_if_error: true
            token: ${{ secrets.CODECOV_TOKEN }}
            env_vars: OS,RUST

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/workflows/publish-npm.yml Outdated Show resolved Hide resolved
.github/workflows/publish-npm.yml Show resolved Hide resolved
@fadeev fadeev requested a review from fbac September 2, 2024 02:55
@brewmaster012
Copy link
Contributor

Whats the versioning of the published package?

@fadeev
Copy link
Member Author

fadeev commented Sep 3, 2024

Whats the versioning of the published package?

To publish an npm package we'll be creating a GH release. Version specified in the release will be set as the version of the npm package.

Screenshot 2024-09-03 at 17 57 25

@fadeev fadeev merged commit 1f3f4b6 into main Sep 5, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a workflow to publish IDL files to npm
5 participants