diff --git a/.changeset/README.md b/.changeset/README.md deleted file mode 100644 index e5b6d8d6a..000000000 --- a/.changeset/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Changesets - -Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works -with multi-package repos, or single-package repos to help you version and publish your code. You can -find the full documentation for it [in our repository](https://github.com/changesets/changesets) - -We have a quick list of common questions to get you started engaging with this project in -[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json deleted file mode 100644 index a4c77f392..000000000 --- a/.changeset/config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", - "changelog": "@changesets/cli/changelog", - "commit": false, - "fixed": [], - "linked": [], - "access": "public", - "baseBranch": "main", - "updateInternalDependencies": "minor", - "ignore": [] -} diff --git a/.github/release-please/config.json b/.github/release-please/config.json new file mode 100644 index 000000000..6c53c2c94 --- /dev/null +++ b/.github/release-please/config.json @@ -0,0 +1,41 @@ +{ + "separate-pull-requests": true, + "group-pull-request-title-pattern": "chore(${component}): release at branch ${branch}", + "bootstrap-sha": "4d2086931dcebd7e7c21cad9cbd6668c2abbebbf", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "packages": { + "packages/hardhat-zksync-deploy": { + "release-type": "node", + "component": "@matterlabs/hardhat-zksync-deploy" + }, + "packages/hardhat-zksync-solc": { + "release-type": "node", + "component": "@matterlabs/hardhat-zksync-solc" + }, + "packages/hardhat-zksync-upgradable": { + "release-type": "node", + "component": "@matterlabs/hardhat-zksync-upgradable" + }, + "packages/hardhat-zksync-vyper": { + "release-type": "node", + "component": "@matterlabs/hardhat-zksync-vyper" + }, + "packages/hardhat-zksync-verify": { + "release-type": "node", + "component": "@matterlabs/hardhat-zksync-verify" + }, + "packages/hardhat-zksync-toolbox": { + "release-type": "node", + "component": "@matterlabs/hardhat-zksync-toolbox" + }, + "packages/hardhat-zksync-node": { + "release-type": "node", + "component": "@matterlabs/hardhat-zksync-node" + }, + "packages/hardhat-zksync-chai-matchers": { + "release-type": "node", + "component": "@matterlabs/hardhat-zksync-chai-matchers" + } + } +} \ No newline at end of file diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json new file mode 100644 index 000000000..ee159a8e4 --- /dev/null +++ b/.github/release-please/manifest.json @@ -0,0 +1,10 @@ +{ + "packages/hardhat-zksync-deploy": "1.1.1", + "packages/hardhat-zksync-solc": "1.0.5", + "packages/hardhat-zksync-upgradable": "1.2.0", + "packages/hardhat-zksync-vyper": "1.0.4", + "packages/hardhat-zksync-verify": "1.2.1", + "packages/hardhat-zksync-toolbox": "1.2.0", + "packages/hardhat-zksync-node": "1.0.0", + "packages/hardhat-zksync-chai-matchers": "1.2.0" +} \ No newline at end of file diff --git a/.github/workflows/create-release-pull-request.yml b/.github/workflows/create-release-pull-request.yml deleted file mode 100644 index 42cd6b86e..000000000 --- a/.github/workflows/create-release-pull-request.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Create release PR - -on: - push: - branches: - - main - -jobs: - create-release-pull-request: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - fetch-depth: 0 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Create release pull request - uses: changesets/action@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 000000000..b9817dfcb --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,27 @@ +name: Publish packages to github + +on: + push: + branches: + - main + - ethers-v5 + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_please_output: ${{ toJSON(steps.release.outputs) }} + steps: + - name: Run release-please + id: release + uses: google-github-actions/release-please-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + config-file: .github/release-please/config.json + manifest-file: .github/release-please/manifest.json + target-branch: ${{ github.ref_name }} diff --git a/.github/workflows/publish-zkvyper.yml b/.github/workflows/npm-publish.yaml similarity index 52% rename from .github/workflows/publish-zkvyper.yml rename to .github/workflows/npm-publish.yaml index 04be00704..6e2c400a2 100644 --- a/.github/workflows/publish-zkvyper.yml +++ b/.github/workflows/npm-publish.yaml @@ -1,9 +1,34 @@ -name: Publish zkvyper plugin +name: Publish packages to npm on: - push: - tags: - - '@matterlabs/hardhat-zksync-vyper@*' + workflow_dispatch: + inputs: + tag: + required: true + type: choice + description: tag to publish + default: latest + options: + - latest + - beta + - alpha + + package: + required: true + type: choice + description: package to publish + default: hardhat-zksync-deploy + options: + - hardhat-zksync-deploy + - hardhat-zksync-solc + - hardhat-zksync-upgradable + - hardhat-zksync-vyper + - hardhat-zksync-verify + - hardhat-zksync-toolbox + - hardhat-zksync-node + - hardhat-zksync-chai-matchers + - hardhat-zksync-ethers + - hardhat-zksync-verify-vyper jobs: publish: @@ -24,23 +49,7 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-vyper --tag beta --workspace=packages/hardhat-zksync-vyper --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-vyper --tag latest --workspace=packages/hardhat-zksync-vyper --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-vyper - else - echo "Skipping github release creation for beta tag" - fi + npm publish @matterlabs/${{inputs.package}} --tag ${{ inputs.tag }} --workspace=packages/${{inputs.package}} --access=public - name: Create the MM Message env: diff --git a/.github/workflows/publish-chai-matchers.yml b/.github/workflows/publish-chai-matchers.yml deleted file mode 100644 index 421f80520..000000000 --- a/.github/workflows/publish-chai-matchers.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Publish chai matchers plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-chai-matchers@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-chai-matchers --tag beta --workspace=packages/hardhat-zksync-chai-matchers --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-chai-matchers --tag latest --workspace=packages/hardhat-zksync-chai-matchers --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-chai-matchers - else - echo "Skipping github release creation for beta tag" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} diff --git a/.github/workflows/publish-deploy.yml b/.github/workflows/publish-deploy.yml deleted file mode 100644 index 719f9981e..000000000 --- a/.github/workflows/publish-deploy.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Publish deploy plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-deploy@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-deploy --tag beta --workspace=packages/hardhat-zksync-deploy --access=public - elif [[ ${{ github.ref }} == *"alpha"* ]]; then - echo "Publishing package with alpha tag" - npm publish @matterlabs/hardhat-zksync-deploy --tag alpha --workspace=packages/hardhat-zksync-deploy --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-deploy --tag latest --workspace=packages/hardhat-zksync-deploy --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-deploy - else - echo "Skipping github release creation for beta tag" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} diff --git a/.github/workflows/publish-node.yaml b/.github/workflows/publish-node.yaml deleted file mode 100644 index 0917afb08..000000000 --- a/.github/workflows/publish-node.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Publish Node Plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-node@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-node --tag beta --workspace=packages/hardhat-zksync-node --access=public - elif [[ ${{ github.ref }} == *"alpha"* ]]; then - echo "Publishing package with alpha tag" - npm publish @matterlabs/hardhat-zksync-node --tag alpha --workspace=packages/hardhat-zksync-node --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-node --tag latest --workspace=packages/hardhat-zksync-node --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]] && [[ ${{ github.ref }} != *"alpha"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-node - else - echo "Skipping github release creation for beta and alpha tags" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} - diff --git a/.github/workflows/publish-toolbox.yml b/.github/workflows/publish-toolbox.yml deleted file mode 100644 index 151525900..000000000 --- a/.github/workflows/publish-toolbox.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Publish toolbox plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-toolbox@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-toolbox --tag beta --workspace=packages/hardhat-zksync-toolbox --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-toolbox --tag latest --workspace=packages/hardhat-zksync-toolbox --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-toolbox - else - echo "Skipping github release creation for beta tag" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} diff --git a/.github/workflows/publish-upgradable.yml b/.github/workflows/publish-upgradable.yml deleted file mode 100644 index 368f32ef7..000000000 --- a/.github/workflows/publish-upgradable.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Publish upgradable plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-upgradable@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-upgradable --tag beta --workspace=packages/hardhat-zksync-upgradable --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-upgradable --tag latest --workspace=packages/hardhat-zksync-upgradable --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-upgradable - else - echo "Skipping github release creation for beta tag" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} diff --git a/.github/workflows/publish-verify.yml b/.github/workflows/publish-verify.yml deleted file mode 100644 index bcedc75dc..000000000 --- a/.github/workflows/publish-verify.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Publish verify plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-verify@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-verify --tag beta --workspace=packages/hardhat-zksync-verify --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-verify --tag latest --workspace=packages/hardhat-zksync-verify --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-verify - else - echo "Skipping github release creation for beta tag" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} diff --git a/.github/workflows/publish-zksolc.yml b/.github/workflows/publish-zksolc.yml deleted file mode 100644 index 933266bf9..000000000 --- a/.github/workflows/publish-zksolc.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Publish zksolc plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-solc@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-solc --tag beta --workspace=packages/hardhat-zksync-solc --access=public - elif [[ ${{ github.ref }} == *"alpha"* ]]; then - echo "Publishing package with alpha tag" - npm publish @matterlabs/hardhat-zksync-solc --tag alpha --workspace=packages/hardhat-zksync-solc --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-solc --tag latest --workspace=packages/hardhat-zksync-solc --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-solc - else - echo "Skipping github release creation for beta tag" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} diff --git a/.github/workflows/publish-zksync-ethers.yaml b/.github/workflows/publish-zksync-ethers.yaml deleted file mode 100644 index 764756312..000000000 --- a/.github/workflows/publish-zksync-ethers.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Publish zksync-ethers plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-ethers@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-ethers --tag beta --workspace=packages/hardhat-zksync-ethers --access=public - elif [[ ${{ github.ref }} == *"alpha"* ]]; then - echo "Publishing package with alpha tag" - npm publish @matterlabs/hardhat-zksync-ethers --tag alpha --workspace=packages/hardhat-zksync-ethers --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-ethers --tag latest --workspace=packages/hardhat-zksync-ethers --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]] && [[ ${{ github.ref }} != *"alpha"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-ethers - else - echo "Skipping github release creation for beta and alpha tags" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} - diff --git a/.github/workflows/publish-zkvyper-verify.yml b/.github/workflows/publish-zkvyper-verify.yml deleted file mode 100644 index 9d4ab8f89..000000000 --- a/.github/workflows/publish-zkvyper-verify.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Publish zkvyper verify plugin - -on: - push: - tags: - - '@matterlabs/hardhat-zksync-verify-vyper@*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: 'https://registry.npmjs.org' - cache: 'yarn' - - - name: Setup environment - run: yarn && yarn build - - - name: Publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }} - run: | - if [[ ${{ github.ref }} == *"beta"* ]]; then - echo "Publishing package with beta tag" - npm publish @matterlabs/hardhat-zksync-verify-vyper --tag beta --workspace=packages/hardhat-zksync-verify-vyper --access=public - elif [[ ${{ github.ref }} == *"alpha"* ]]; then - echo "Publishing package with alpha tag" - npm publish @matterlabs/hardhat-zksync-verify-vyper --tag alpha --workspace=packages/hardhat-zksync-verify-vyper --access=public - else - echo "Publishing package with latest tag" - npm publish @matterlabs/hardhat-zksync-verify-vyper --tag latest --workspace=packages/hardhat-zksync-verify-vyper --access=public - fi - - - name: Create github release from tags - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [[ ${{ github.ref }} != *"beta"* ]]; then - node scripts/create-release-from-tags/run.js --package hardhat-zksync-verify-vyper - else - echo "Skipping github release creation for beta tag" - fi - - - name: Create the MM Message - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh -R matter-labs/hardhat-zksync release view "$GITHUB_REF_NAME" --json tagName,body --template '## {{.tagName}} {{"\n"}}{{.body}}' > ./release_info - jq --null-input --arg text "$(cat ./release_info)" '{"text": $text}' > mattermost.json - - - uses: mattermost/action-mattermost-notify@master - env: - MATTERMOST_USERNAME: "Hardhat Release Bot" - MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_URL }} diff --git a/scripts/create-release-from-tags/index.js b/scripts/create-release-from-tags/index.js deleted file mode 100644 index e357abe3c..000000000 --- a/scripts/create-release-from-tags/index.js +++ /dev/null @@ -1,187 +0,0 @@ -import { Command } from 'commander'; -import spawn from '@npmcli/promise-spawn'; -import getPackages from 'get-monorepo-packages'; -import path from 'path'; -import fs from 'fs'; - -/** - * - * @returns list of tags based on package name - * @example ["@matterlabs/hardhat-zksync-solc@0.3.15", "@matterlabs/hardhat-zksync-solc@0.3.16"] - */ -const getCurrentGitTagsForPackage = async (packageName) => { - const { stdout, stderr, code } = await spawn('git', [ - 'tag', - '--points-at', - 'HEAD', - '--column', - ]); - - if (code !== 0) { - throw new Error(stderr.toString()); - } - - return parseRawTags(stdout.toString(), packageName); -}; - -const getChangelogPath = (packageName) => { - const result = getPackages('.').find((p) => p.package.name.includes(packageName)); - if (!result) { - throw new Error(`could not find package with name: ${packageName}.`); - } - - let changelogPath; - for (const fileName of ['CHANGELOG.MD', 'CHANGELOG.md']) { - const myPath = path.join(result.location, fileName); - const pathExists = fs.existsSync(myPath); - if (pathExists) { - changelogPath = myPath; - break; - } - } - - if (!changelogPath) { - console.log(`could not find changelog path for ${result.location}`); - } - - return changelogPath; -}; - -/** - * - * @returns list of tags - * @example ["@matterlabs/hardhat-zksync-solc@0.3.16", "@matterlabs/hardhat-zksync-deploy@0.6.3"] - */ -const createGithubRelease = async (tag, releaseNotes) => { - let args = ['release', 'create', tag, '--title', tag, '--notes', releaseNotes || '']; - - if(tag.includes("alpha") || tag.includes("beta")) { - args.push('--prerelease'); - } - - const { stderr, code } = await spawn('gh', args); - - if (code !== 0) { - throw new Error(stderr.toString()); - } -}; - -/** - * - * @param rawTag - ex. "@matterlabs/hardhat-zksync-solc@0.3.16" - */ -const extractPartsFromTag = (rawTag) => { - const [name, version] = rawTag.split(/@(\d.*)/); - if (!name || !version) { - return undefined; - } - - return { - name, - versionNumber: version?.replace('\n', ''), - raw: rawTag, - }; -}; - -/** - * Removes nullish values. - */ -const exists = (value) => { - return value != null && value !== undefined; -}; - -/** - * - * @param rawTags - string delimited list of tags (e.g. `@matterlabs/hardhat-zksync-solc@0.3.16 @matterlabs/hardhat-zksync-deploy@0.6.3`) - */ -const parseRawTags = (rawTags, packageName) => { - let tags = rawTags.trim().split(' ').map(extractPartsFromTag).filter(exists); - - if (packageName) { - tags = tags.filter((tag) => tag.name.includes(packageName)); - } - - return tags; -}; - -/** - * - * @returns the release notes that correspond to a given tag. - */ -export const parseReleaseNotes = ( - changelogText, - versionNumber -) => { - const h2tag = /(##\s.*\d.*)/gi; - let begin; - let end; - - changelogText.split('\n').forEach((line, idx) => { - if (begin && end) { - return; - } - if (line.includes(versionNumber)) { - begin = idx + 1; - } else if (begin && h2tag.test(line)) { - end = idx - 1; - } - }); - - const result = changelogText.split('\n').filter((_, idx) => { - return idx >= begin && idx <= (end ?? Infinity); - }); - - return result.join('\n'); -}; - -const getReleaseNotes = (tag) => { - const { name, versionNumber } = tag; - const changelogPath = getChangelogPath(name); - if (!changelogPath) { - console.log(`no changelog path for ${name}... skipping.`); - return; - } - - const changelogText = fs.readFileSync(changelogPath, { encoding: 'utf8' }); - const releaseNotes = parseReleaseNotes(changelogText, versionNumber); - if (!releaseNotes) { - console.log( - `Could not find release notes for tags ${tag.raw} in ${changelogPath}.` - ); - }; - - return releaseNotes; -}; - -const createGithubReleaseFromTag = async (tag) => { - const notes = getReleaseNotes(tag); - if (notes) { - console.log( - `\n ---> Outputting release titled: ${tag.raw} with notes: \n ${notes}` - ) - } - - await createGithubRelease(tag.raw, notes); -}; - -const createReleaseFromTags = async (tags) => { - console.log('Processing tags:', tags, '\n'); - - for (const tag of tags) { - await createGithubReleaseFromTag(tag); - } -}; - -export async function main() { - const program = new Command(); - - program - .name('create-github-release-from-tags') - .option('-p, --package ', 'Package name to create release for') - .action(async (cmd) => { - const tags = await getCurrentGitTagsForPackage(cmd.package); - return createReleaseFromTags(tags); - }); - - await program.parseAsync(process.argv); -} diff --git a/scripts/create-release-from-tags/run.js b/scripts/create-release-from-tags/run.js deleted file mode 100644 index 24501cb9e..000000000 --- a/scripts/create-release-from-tags/run.js +++ /dev/null @@ -1,8 +0,0 @@ -import { main } from './index.js'; - -main() - .then(() => process.exit(0)) - .catch((err) => { - console.error('Error: ', err); - process.exit(1); - });