From d12291dd5781214cbc3336aa09ed6c6f246e9054 Mon Sep 17 00:00:00 2001 From: Alison Oliveira <87387688+arobsn@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:03:52 -0300 Subject: [PATCH] Add preview publishing (#151) * fix `repository` tag * add ci * set corepack version to 3 * temporarily disable other CI * back to v3 * bump checkout to v4 * refactor * fix structure * bump everything to v4 * enable compact mode * only run if CI is successful * Revert "only run if CI is successful" This reverts commit 55a0af143eebcd9a0fd4af5be5b3e311be33485b. * enable other workflows * integrated release.yml into ci.yml * fix preview steps * fix preview steps * bump actions versions * test reusable jobs setup * set cache * cache node * revert reusable jobs --- .github/workflows/ci.yml | 68 ++++++++++++++++------ .github/workflows/coverage.yml | 16 ++--- .github/workflows/release.yml | 6 +- package.json | 2 +- packages/blockchain-providers/package.json | 2 +- packages/common/package.json | 2 +- packages/compiler/package.json | 2 +- packages/core/package.json | 2 +- packages/crypto/package.json | 2 +- packages/mock-chain/package.json | 2 +- packages/serializer/package.json | 2 +- packages/wallet/package.json | 2 +- plugins/ageusd/package.json | 2 +- plugins/babel-fees/package.json | 2 +- 14 files changed, 74 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b1add0d..218f3053 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,12 @@ name: CI on: - push: - branches: ["master"] pull_request: - branches: ["master"] + push: + branches: + - "master" + tags: + - "!**" concurrency: group: ci-${{ github.event.pull_request.number || github.ref }} @@ -16,13 +18,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 9 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20 cache: "pnpm" @@ -34,13 +36,13 @@ jobs: name: Format runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 9 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20 cache: "pnpm" @@ -57,14 +59,14 @@ jobs: matrix: node-version: [18, 20] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 9 - name: Build and test using Node.js v${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: "pnpm" @@ -82,9 +84,9 @@ jobs: matrix: bun-version: ["latest"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 9 @@ -104,14 +106,14 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 9 - name: Build using Node.js v20 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 cache: "pnpm" @@ -124,3 +126,35 @@ jobs: - name: Test using edge-runtime run: pnpm run test:unit-edge + + publish-preview: + name: "Publish preview" + runs-on: ubuntu-latest + needs: build-and-test-node + if: success() + timeout-minutes: 20 + strategy: + fail-fast: false + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Enable corepack + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm -r build + + - name: Publish + run: pnpx pkg-pr-new publish './packages/*' './plugins/*' --no-template --pnpm --compact diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 219fed56..82dcc9a9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,24 +1,26 @@ name: Coverage on: - push: - branches: ["master"] pull_request: - branches: ["master"] + push: + branches: + - "master" + tags: + - "!**" jobs: coverage: name: Check and submit runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 9 - name: Collect coverage - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 cache: "pnpm" @@ -28,7 +30,7 @@ jobs: - name: Submit report if: success() || failure() - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage/coverage-final.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1e19637..5aa9aed4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,14 +20,14 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 9 - name: Setup Node.js 20.x - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 cache: "pnpm" diff --git a/package.json b/package.json index 5f6947f9..740f1076 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": "true", - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "type": "module", "scripts": { diff --git a/packages/blockchain-providers/package.json b/packages/blockchain-providers/package.json index 14bbeb80..77ba2f13 100644 --- a/packages/blockchain-providers/package.json +++ b/packages/blockchain-providers/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/packages/common/package.json b/packages/common/package.json index 86fc4567..89fa2e5c 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/packages/compiler/package.json b/packages/compiler/package.json index 26764709..2d78bd4d 100644 --- a/packages/compiler/package.json +++ b/packages/compiler/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/packages/core/package.json b/packages/core/package.json index 2509c0fb..ef8c6aa3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/packages/crypto/package.json b/packages/crypto/package.json index 9e87652b..009b67c2 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/packages/mock-chain/package.json b/packages/mock-chain/package.json index de0c6983..7fef2a02 100644 --- a/packages/mock-chain/package.json +++ b/packages/mock-chain/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/packages/serializer/package.json b/packages/serializer/package.json index 8f76f01d..2e1473d0 100644 --- a/packages/serializer/package.json +++ b/packages/serializer/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/packages/wallet/package.json b/packages/wallet/package.json index ee53a2ae..4b783edb 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -23,7 +23,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/plugins/ageusd/package.json b/plugins/ageusd/package.json index 5206af4f..05d14c27 100644 --- a/plugins/ageusd/package.json +++ b/plugins/ageusd/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public", diff --git a/plugins/babel-fees/package.json b/plugins/babel-fees/package.json index c78ccdff..d1ec85bf 100644 --- a/plugins/babel-fees/package.json +++ b/plugins/babel-fees/package.json @@ -18,7 +18,7 @@ } }, "sideEffects": false, - "repository": "fleet-sdk/fleet", + "repository": "github:fleet-sdk/fleet", "license": "MIT", "publishConfig": { "access": "public",