From d6d1c9030dacd0ce8e03734b7312f31772cb7599 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 9 Oct 2024 17:45:47 -0700 Subject: [PATCH] update workflows --- .github/workflows/codegen-types-dryrun.yml | 19 ++--- .github/workflows/codegen-types.yml | 17 ++--- ...-dryrun.yml => v1-codegen-main-dryrun.yml} | 17 ++--- .../{codegen-main.yml => v1-codegen-main.yml} | 19 ++--- ...h-minor.yml => v1-lerna-publish-minor.yml} | 16 ++-- .github/workflows/v1-lerna-publish.yaml | 40 ++++++++++ .github/workflows/v2-codegen-main.yml | 75 +++++++++++++++++++ ...publish.yml => v2-lerna-publish-minor.yml} | 19 ++--- .github/workflows/v2-lerna-publish.yaml | 40 ++++++++++ 9 files changed, 189 insertions(+), 73 deletions(-) rename .github/workflows/{codegen-main-dryrun.yml => v1-codegen-main-dryrun.yml} (80%) rename .github/workflows/{codegen-main.yml => v1-codegen-main.yml} (85%) rename .github/workflows/{lerna-publish-minor.yml => v1-lerna-publish-minor.yml} (72%) create mode 100644 .github/workflows/v1-lerna-publish.yaml create mode 100644 .github/workflows/v2-codegen-main.yml rename .github/workflows/{lerna-publish.yml => v2-lerna-publish-minor.yml} (61%) create mode 100644 .github/workflows/v2-lerna-publish.yaml diff --git a/.github/workflows/codegen-types-dryrun.yml b/.github/workflows/codegen-types-dryrun.yml index a179e905e..6a55ffb0f 100644 --- a/.github/workflows/codegen-types-dryrun.yml +++ b/.github/workflows/codegen-types-dryrun.yml @@ -19,24 +19,16 @@ jobs: - name: Update Git Submodules ๐Ÿ”„ run: | - make update-cosmos # Fixed typo here + make update-cosmos - - name: Install Dependencies ๐Ÿงถ + - name: V2 Operations ๐Ÿ›  run: | - cd v2 + pushd v2 yarn install yarn symlink - - - name: Build Project ๐Ÿ—๏ธ - run: | - cd v2 yarn build yarn symlink - - name: Types Generation ๐Ÿ›  - run: | - cd v2 - # Generate types and interfaces pushd workflows/generate-types yarn generate:types @@ -59,9 +51,10 @@ jobs: yarn build popd - cd .. + popd - # check changes + - name: Check for Changes + run: | git add . if ! git diff --staged --quiet; then echo "GIT_RESULT=Changes to commit and/or publish." >> $GITHUB_ENV diff --git a/.github/workflows/codegen-types.yml b/.github/workflows/codegen-types.yml index e167a923f..435d8a9be 100644 --- a/.github/workflows/codegen-types.yml +++ b/.github/workflows/codegen-types.yml @@ -21,22 +21,14 @@ jobs: run: | make update-cosmos - - name: Install Dependencies ๐Ÿงถ + - name: V2 Operations ๐Ÿ›  run: | - cd v2 + pushd v2 yarn install yarn symlink - - - name: Build Project ๐Ÿ—๏ธ - run: | - cd v2 yarn build yarn symlink - - name: Types Generation ๐Ÿ›  - run: | - cd v2 - # Generate types and interfaces pushd workflows/generate-types yarn generate:types @@ -59,9 +51,10 @@ jobs: yarn build popd - cd .. + popd - # Stage all changes and commit if there are any changes + - name: Commit and Push Changes + run: | git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" git add . diff --git a/.github/workflows/codegen-main-dryrun.yml b/.github/workflows/v1-codegen-main-dryrun.yml similarity index 80% rename from .github/workflows/codegen-main-dryrun.yml rename to .github/workflows/v1-codegen-main-dryrun.yml index bf87cf023..ec2ff4d2e 100644 --- a/.github/workflows/codegen-main-dryrun.yml +++ b/.github/workflows/v1-codegen-main-dryrun.yml @@ -1,4 +1,4 @@ -name: Codegen Main Dry Run +name: Codegen Main V1 Dry Run on: workflow_dispatch: @@ -22,23 +22,18 @@ jobs: run: | make update-cosmos - - name: Install Dependencies ๐Ÿงถ + - name: V1 Operations ๐Ÿ›  run: | - cd v1 + pushd v1 yarn install yarn symlink - - - name: Build Project ๐Ÿ—๏ธ - run: | - cd v1 yarn build yarn symlink + yarn codegen + popd - - name: Code Generation ๐Ÿ›  + - name: Check for Changes run: | - cd v1 - yarn codegen - cd .. git add . if ! git diff --staged --quiet; then echo "GIT_RESULT=Changes detected." >> $GITHUB_ENV diff --git a/.github/workflows/codegen-main.yml b/.github/workflows/v1-codegen-main.yml similarity index 85% rename from .github/workflows/codegen-main.yml rename to .github/workflows/v1-codegen-main.yml index cd59fd44f..faf1705ed 100644 --- a/.github/workflows/codegen-main.yml +++ b/.github/workflows/v1-codegen-main.yml @@ -1,4 +1,4 @@ -name: Codegen Main +name: Codegen Main V1 on: schedule: @@ -26,22 +26,14 @@ jobs: run: | make update-cosmos - - name: Install Dependencies ๐Ÿงถ + - name: V1 Operations ๐Ÿ›  run: | - cd v1 + pushd v1 yarn install yarn symlink - - - name: Build Project ๐Ÿ—๏ธ - run: | - cd v1 yarn build yarn symlink - - name: Code Generation ๐Ÿ›  - run: | - cd v1 - # Code generation and build for various packages pushd packages/chain-registry yarn codegen @@ -60,9 +52,10 @@ jobs: yarn codegen popd - cd .. + popd - # Stage all changes and commit if there are any changes + - name: Commit Changes + run: | git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" git add . diff --git a/.github/workflows/lerna-publish-minor.yml b/.github/workflows/v1-lerna-publish-minor.yml similarity index 72% rename from .github/workflows/lerna-publish-minor.yml rename to .github/workflows/v1-lerna-publish-minor.yml index 0de33574d..323a31d8e 100644 --- a/.github/workflows/lerna-publish-minor.yml +++ b/.github/workflows/v1-lerna-publish-minor.yml @@ -1,6 +1,11 @@ -name: Lerna Publish Minor +name: Lerna Publish Minor V1 on: + workflow_run: + workflows: ["Codegen Main V1"] + types: + - completed + workflow_dispatch: jobs: @@ -29,15 +34,6 @@ jobs: cd v1 yarn lerna publish minor --force-publish=chain-registry --no-verify-access --yes - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_SECRET}} - GH_TOKEN: ${{ secrets.GH_LERNA_PUBLISH_TOKEN }} - - - name: Publish v2 Minor Version - run: | - cd v2 - yarn - lerna publish --force-publish=@chain-registry/v2 --no-verify-access --yes env: NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_SECRET}} GH_TOKEN: ${{ secrets.GH_LERNA_PUBLISH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/v1-lerna-publish.yaml b/.github/workflows/v1-lerna-publish.yaml new file mode 100644 index 000000000..648575f65 --- /dev/null +++ b/.github/workflows/v1-lerna-publish.yaml @@ -0,0 +1,40 @@ +name: Lerna Publish V1 + +on: + workflow_run: + workflows: ["Codegen Main V1"] + types: + - completed + + workflow_dispatch: + +jobs: + publish-npm: + name: Publish V1 Version + runs-on: ubuntu-latest + steps: + - name: Checkout Repository ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + with: + submodules: "true" + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: https://registry.npmjs.org/ + + - name: Configure Git + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor}}@users.noreply.github.com" + + - name: Publish V1 Version ๐Ÿš€ + run: | + pushd v1 + yarn + yarn lerna publish --force-publish=chain-registry --no-verify-access --yes + popd + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_SECRET}} + GH_TOKEN: ${{ secrets.GH_LERNA_PUBLISH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/v2-codegen-main.yml b/.github/workflows/v2-codegen-main.yml new file mode 100644 index 000000000..45ec72629 --- /dev/null +++ b/.github/workflows/v2-codegen-main.yml @@ -0,0 +1,75 @@ +name: Codegen Main V2 + +on: + schedule: + # Runs every day at 1:00 AM UTC + - cron: "0 1 * * *" + + workflow_dispatch: + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository ๐Ÿ“ฅ + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Setup Node.js ๐ŸŒ + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: https://registry.npmjs.org/ + + - name: Update Git Submodules ๐Ÿ”„ + run: | + make update-cosmos + + - name: V2 Operations ๐Ÿ›  + run: | + pushd v2 + yarn install + yarn symlink + yarn build + yarn symlink + + # Code generation and build for various packages + pushd packages/chain-registry + yarn codegen + yarn build + popd + + # pushd packages/assets + # yarn codegen + # popd + + # pushd packages/osmosis + # yarn codegen + # popd + + # pushd packages/juno + # yarn codegen + # popd + + popd + + - name: Commit Changes + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + git add . + if ! git diff --staged --quiet; then + git commit -am "build ๐Ÿ›  build-$(date +%Y%m%d-%H%M%S)" + git push origin main + echo "GIT_RESULT=Published." >> $GITHUB_ENV + else + echo "GIT_RESULT=No changes to commit." >> $GITHUB_ENV + fi + + - name: Git Ops + run: | + echo $GIT_RESULT + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_SECRET}} + GH_TOKEN: ${{ secrets.GH_LERNA_PUBLISH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/lerna-publish.yml b/.github/workflows/v2-lerna-publish-minor.yml similarity index 61% rename from .github/workflows/lerna-publish.yml rename to .github/workflows/v2-lerna-publish-minor.yml index fceabc27d..c5e546321 100644 --- a/.github/workflows/lerna-publish.yml +++ b/.github/workflows/v2-lerna-publish-minor.yml @@ -1,8 +1,8 @@ -name: Lerna Publish +name: Lerna Publish Minor V2 on: workflow_run: - workflows: ["Codegen Main"] + workflows: ["Codegen Main V2"] types: - completed @@ -10,7 +10,7 @@ on: jobs: publish-npm: - name: Publish Versions + name: Publish Minor Versions runs-on: ubuntu-latest steps: - name: Checkout Repository ๐Ÿ›Ž๏ธ @@ -29,20 +29,11 @@ jobs: git config user.name "${{ github.actor }}" git config user.email "${{ github.actor}}@users.noreply.github.com" - - name: Publish v1 Version - run: | - cd v1 - yarn - lerna publish --force-publish=chain-registry --no-verify-access --yes - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_SECRET}} - GH_TOKEN: ${{ secrets.GH_LERNA_PUBLISH_TOKEN }} - - - name: Publish v2 Version + - name: Publish V2 Minor Version run: | cd v2 yarn - lerna publish --force-publish=@chain-registry/v2 --no-verify-access --yes + lerna publish minor --force-publish=@chain-registry/v2 --no-verify-access --yes env: NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_SECRET}} GH_TOKEN: ${{ secrets.GH_LERNA_PUBLISH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/v2-lerna-publish.yaml b/.github/workflows/v2-lerna-publish.yaml new file mode 100644 index 000000000..61f477cef --- /dev/null +++ b/.github/workflows/v2-lerna-publish.yaml @@ -0,0 +1,40 @@ +name: Lerna Publish V2 + +on: + workflow_run: + workflows: ["Codegen Main V2"] + types: + - completed + + workflow_dispatch: + +jobs: + publish-npm: + name: Publish V2 Version + runs-on: ubuntu-latest + steps: + - name: Checkout Repository ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + with: + submodules: "true" + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: https://registry.npmjs.org/ + + - name: Configure Git + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor}}@users.noreply.github.com" + + - name: Publish V2 Version ๐Ÿš€ + run: | + pushd v2 + yarn + yarn lerna publish --force-publish=@chain-registry/v2 --no-verify-access --yes + popd + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_SECRET}} + GH_TOKEN: ${{ secrets.GH_LERNA_PUBLISH_TOKEN }} \ No newline at end of file