updated config #92
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build, Deploy Contracts & Publish to Vercel | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request_target: | |
| branches: | |
| - main | |
| - next | |
| workflow_dispatch: | |
| inputs: | |
| production: | |
| description: 'Deploy to production' | |
| required: false | |
| default: true | |
| type: boolean | |
| env: | |
| PASSWORD: ${{ secrets.PASSWORD }} | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Extract Aztec version | |
| id: aztec-version | |
| run: | | |
| VERSION=$(jq -r '.dependencies["@aztec/aztec.js"]' package.json) | |
| VERSION_NO_V=${VERSION#v} | |
| echo "version=$VERSION_NO_V" >> $GITHUB_OUTPUT | |
| echo "Aztec version: $VERSION_NO_V" | |
| - name: Install Aztec CLI | |
| run: | | |
| export CI=1 | |
| export FOUNDRY_DIR="$HOME/.foundry" | |
| echo "Running version-specific installer for ${{ steps.aztec-version.outputs.version }}..." | |
| curl -fsSL "https://install.aztec.network/${{ steps.aztec-version.outputs.version }}/install" | VERSION="${{ steps.aztec-version.outputs.version }}" bash | |
| echo "Installation completed" | |
| ls -la ~/.aztec/versions/${{ steps.aztec-version.outputs.version }}/bin/ | |
| - name: Update path | |
| run: | | |
| echo "$HOME/.aztec/versions/${{ steps.aztec-version.outputs.version }}/bin" >> $GITHUB_PATH | |
| echo "$HOME/.aztec/versions/${{ steps.aztec-version.outputs.version }}/node_modules/.bin" >> $GITHUB_PATH | |
| - name: Compile contracts | |
| run: yarn compile:contracts | |
| - name: Install Vercel CLI | |
| run: npm install --global vercel@latest | |
| - name: Pull Vercel Environment Information | |
| run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Build and deploy to Vercel | |
| id: deploy | |
| env: | |
| VITE_WEB_WALLET_URL: ${{ vars.VITE_WEB_WALLET_URL }} | |
| run: | | |
| if ([ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]) || ([ "${{ github.event_name }}" == "workflow_dispatch" ] && [ "${{ inputs.production }}" == "true" ]); then | |
| vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| DEPLOY_URL=$(vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz --yes) | |
| else | |
| vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
| DEPLOY_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz --yes) | |
| fi | |
| echo "url=$DEPLOY_URL" >> $GITHUB_OUTPUT | |
| - name: Comment deployment URL on PR | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '🚀 Deployed to Vercel!\n\n**Preview URL:** ${{ steps.deploy.outputs.url }}' | |
| }) |