From 0bdf44c256dcce32f5ba299154d6155c09bc0e9e Mon Sep 17 00:00:00 2001 From: Federico Giacon <58218759+fedgiac@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:46:04 +0000 Subject: [PATCH] Move NPM package support from `main` to `v1` (#237) ## Description There is little JS code remaining in the `main` branch. This PR makes it clear that there is no NPM package available for this code (at least yet) and that maintenance work on the current package has moved to the [`v1` branch](https://github.com/cowprotocol/contracts/pull/235#issue-2718325727). --- .github/workflows/publish.yml | 19 -------------- README.md | 14 +--------- package.json | 3 ++- src/workflows/publish.sh | 49 ----------------------------------- 4 files changed, 3 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/publish.yml delete mode 100644 src/workflows/publish.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index e8022e2a..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Publish package to NPM - -on: - workflow_dispatch: - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - scope: '@cowprotocol' - - run: yarn --frozen-lockfile - - run: bash src/workflows/publish.sh - env: - NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} diff --git a/README.md b/README.md index cce53150..35b50366 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ > [!IMPORTANT] -> This repository is in the process of being migrated to the [Foundry](https://getfoundry.sh) Ethereum application development environment. Developers wishing to integrate and/or develop on the CoW Protocol smart contracts with hardhat should refer to tag [`v1.6.0`](https://github.com/cowprotocol/contracts/releases/tag/v1.6.0) [Browse files](https://github.com/cowprotocol/contracts/tree/1d673839a7402bdb2949175ebb61e8b5c4f39ecb). +> This repository is in the process of being migrated to the [Foundry](https://getfoundry.sh) Ethereum application development environment. Developers wishing to integrate and/or develop on the CoW Protocol smart contracts with hardhat should refer to branch [`v1`](https://github.com/cowprotocol/contracts/tree/v1). # CoW Protocol @@ -157,15 +157,3 @@ To actually execute the transaction: ```sh forge script script/TransferOwnership.s.sol:TransferOwnership --rpc-url "$ETH_RPC_URL" --private-key 0x0000000000000000000000000000000000000000000000000000000000000001 --broadcast --slow ``` - -## Releases - -The content of this repo is published on NPM as [`@cowprotocol/contracts`](https://www.npmjs.com/package/@cowprotocol/contracts). - -Maintainers this repository can manually trigger a new release. The steps are as follows: - -1. Update the package version number in `./package.json` on branch `main`. - -2. On GitHub, visit the "Actions" tab, "Publish package to NPM", "Run workflow" with `main` as the target branch. - -Once the workflow has been executed successfully, a new NPM package version should be available as well as a new git tag named after the released version. diff --git a/package.json b/package.json index 9f91aa40..9562c41d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "name": "@cowprotocol/contracts", - "version": "1.7.0", + "version": "2.0.0-alpha", "license": "LGPL-3.0-or-later", + "private": true, "repository": { "type": "git", "url": "https://github.com/cowprotocol/contracts.git" diff --git a/src/workflows/publish.sh b/src/workflows/publish.sh deleted file mode 100644 index a0d5668c..00000000 --- a/src/workflows/publish.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -set -o nounset -set -o pipefail -set -o errexit - -fail_if_unset () { - local var_name="$1" - if [[ -z "${!var_name:-""}" ]]; then - printf '%s not set\n' "$var_name" >&2 - exit 1 - fi -} - -package_exists () { - npm view --json "$1" &>/dev/null; -} - -fail_if_unset NODE_AUTH_TOKEN - -git_username="GitHub Actions" -git_useremail="GitHub-Actions@cow.fi" - -package_name="$(jq --raw-output .name ./package.json)" -version="$(jq --raw-output .version ./package.json)" - -if package_exists "$package_name" && grep --silent --line-regexp --fixed-strings -- "$version" \ - <(npm view --json "$package_name" | jq '.versions[] | .' --raw-output); then - echo "Version $version already published" - exit 1 -fi - -version_tag="v$version" -if git fetch --end-of-options origin "refs/tags/$version_tag" 2>/dev/null; then - echo "Tag $version_tag is already present" - exit 1 -fi - -yarn publish --access public - -if ! git config --get user.name &>/dev/null; then - git config user.name "$git_username" - git config user.email "$git_useremail" -fi -git tag -m "Version $version" --end-of-options "$version_tag" - -git push origin "refs/tags/$version_tag" - -echo "Package $package_name version $version successfully published."