From ffb0a4ab37af3913ee158ebfde8b66c90523bca1 Mon Sep 17 00:00:00 2001 From: Sebastian Scatularo Date: Wed, 11 Oct 2023 17:44:23 -0300 Subject: [PATCH] update ci preview.yml --- .github/workflows/preview.yml | 88 ++++++++++++----------------------- 1 file changed, 31 insertions(+), 57 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 29b9ef32d..9eaec9227 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -5,39 +5,6 @@ on: types: [opened, synchronize, reopened] jobs: - # cctp: - # name: "Build USDC Bridge (CCTP)" - # runs-on: "ubuntu-latest" - # concurrency: - # group: ${{ github.ref }}-cctp-preview - # cancel-in-progress: true - # environment: Cloudflare-Preview - # steps: - # - name: Checkout repository - # uses: actions/checkout@v3 - # with: - # repository: xlabs/usdc-bridge - # ref: develop - # - name: Set up Node environment - # uses: actions/setup-node@v3 - # with: - # node-version: v16.19.1 - # - name: Install dependencies - # run: npm ci - # - name: Set Version - # run: | - # echo "_BRANCH_NAME_SHA=$(echo ${{ github.event.pull_request.head.ref }} | sha256sum | cut -c -10)" >> "${GITHUB_ENV}" - # - name: Build - # env: - # DEPLOY: "true" - # NEXT_PUBLIC_NETWORK: ${{ vars.REACT_APP_CLUSTER }} - # NEXT_PUBLIC_BASE_PATH: "/${{ env._BRANCH_NAME_SHA }}/usdc-bridge" - # run: npm run build - # - name: Upload Artifact - # uses: actions/upload-artifact@v3 - # with: - # name: preview-stable-bridge-build - # path: out docs: name: "Build Portal Bridge Documentation" runs-on: "ubuntu-latest" @@ -49,7 +16,7 @@ jobs: - name: Set up Node environment uses: actions/setup-node@v3 with: - node-version: v18.17.1 + node-version: v16.19.1 - name: Install dependencies run: | pushd docs @@ -68,51 +35,64 @@ jobs: with: name: docs-preview-build path: docs/build - portal: name: "Build Portal Bridge" - runs-on: xlabs-large-runner + runs-on: "ubuntu-latest" concurrency: group: ${{ github.ref }}-portal-preview cancel-in-progress: true environment: Cloudflare-Preview steps: - - name: Checkout repository - uses: actions/checkout@v3 - name: Set up Node environment uses: actions/setup-node@v3 with: node-version: v18.17.1 + - name: Checkout Wormhole Connect + uses: actions/checkout@v3 + with: + repository: xlabs/wormhole-connect + ref: ${{github.event.pull_request.head.ref}} + path: wormhole-connect + - name: Checkout Portal Bridge + uses: actions/checkout@v3 + with: + path: portal-bridge - name: Setup Git run: | + cd portal-bridge git config user.name "xLabs CI" git config user.email "devops@xlabs.xyz" - - name: Install dependencies - run: npm install - - name: Set Version + - name: Set Portal Bridge Version run: | + cd portal-bridge npm version $(node -p -e "require('./package.json').version")-P$(echo ${{ github.sha }} | cut -c -10) echo "_PKG_VERSION=$(node -p -e "require('./package.json').version")" >> "${GITHUB_ENV}" echo "_BRANCH_NAME_SHA=$(echo ${{ github.event.pull_request.head.ref }} | sha256sum | cut -c -10)" >> "${GITHUB_ENV}" - - name: Build + - name: Build Portal Bridge env: PUBLIC_URL: "/${{ env._BRANCH_NAME_SHA }}" - NODE_OPTIONS: "--max-old-space-size=10240" - REACT_APP_CLUSTER: ${{ vars.REACT_APP_CLUSTER }} - REACT_APP_SOLANA_API_URL: ${{ vars.REACT_APP_SOLANA_API_URL }} - REACT_APP_COVALENT_API_KEY: ${{ secrets.REACT_APP_COVALENT_API_KEY }} - REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID }} + VITE_APP_VERSION: ${{ github.event.pull_request.head.ref }} + VITE_APP_CLUSTER: "mainnet" run: | + npm install -g husky + pushd wormhole-connect + npm ci --workspaces --if-present + npm run build + npm link --workspaces --if-present + popd + pushd portal-bridge + npm ci + npm link @wormhole-foundation/wormhole-connect pushd public npm run set-version popd - echo 'REACT_APP_VERSION=$npm_package_version' > .env + echo 'VITE_APP_VERSION=$npm_package_version' > .env npm run build - - name: Upload Artifact + - name: Upload Portal Bridge Artifact uses: actions/upload-artifact@v3 with: name: preview-build - path: build + path: portal-bridge/dist - name: Deploy metadata run: | mkdir deploy-metadata @@ -130,7 +110,6 @@ jobs: needs: - portal - docs - # - cctp runs-on: "ubuntu-latest" concurrency: group: ${{ github.ref }}-publish-preview @@ -148,15 +127,10 @@ jobs: with: name: docs-preview-build path: docs - # - name: Download Artifact - # uses: actions/download-artifact@v3 - # with: - # name: preview-stable-bridge-build - # path: usdc-bridge - name: Set up GitHub NPM registry uses: actions/setup-node@v3 with: - node-version: v18.17.1 + node-version: v16.19.1 registry-url: https://npm.pkg.github.com - name: Publish env: