|
| 1 | +name: Build, Deploy Contracts & Publish to Vercel |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +env: |
| 13 | + PASSWORD: ${{ secrets.PASSWORD }} |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-and-deploy: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Set up Node.js |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: '22' |
| 27 | + |
| 28 | + - name: Enable Corepack |
| 29 | + run: corepack enable |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + run: yarn install --immutable |
| 33 | + |
| 34 | + - name: Install Aztec CLI |
| 35 | + run: | |
| 36 | + curl -s https://install.aztec.network > tmp.sh |
| 37 | + bash tmp.sh <<< yes "yes" |
| 38 | +
|
| 39 | + - name: Update path |
| 40 | + run: echo "/home/runner/.aztec/bin" >> $GITHUB_PATH |
| 41 | + |
| 42 | + - name: Set Aztec version |
| 43 | + run: | |
| 44 | + aztec-up ${{ env.VERSION }} |
| 45 | + docker pull aztecprotocol/aztec:${{ env.VERSION }} |
| 46 | + docker tag aztecprotocol/aztec:${{ env.VERSION }} |
| 47 | + aztecprotocol/aztec:latest |
| 48 | +
|
| 49 | + - name: Copy token contract dependencies |
| 50 | + run: yarn copy:dependencies |
| 51 | + |
| 52 | + - name: Compile contracts |
| 53 | + run: yarn compile:contracts |
| 54 | + |
| 55 | + - name: Build website |
| 56 | + run: yarn build |
| 57 | + |
| 58 | + - name: Deploy contracts to devnet |
| 59 | + run: yarn deploy:devnet |
| 60 | + env: |
| 61 | + PASSWORD: ${{ secrets.PASSWORD }} |
| 62 | + |
| 63 | + - name: Install Vercel CLI |
| 64 | + run: npm install --global vercel@latest |
| 65 | + |
| 66 | + - name: Pull Vercel Environment Information |
| 67 | + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} |
| 68 | + |
| 69 | + - name: Deploy to Vercel |
| 70 | + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} |
| 71 | + id: deploy |
| 72 | + |
| 73 | + - name: Comment deployment URL on PR |
| 74 | + if: github.event_name == 'pull_request' |
| 75 | + uses: actions/github-script@v7 |
| 76 | + with: |
| 77 | + script: | |
| 78 | + github.rest.issues.createComment({ |
| 79 | + issue_number: context.issue.number, |
| 80 | + owner: context.repo.owner, |
| 81 | + repo: context.repo.repo, |
| 82 | + body: '🚀 Deployed to Vercel!\n\nContracts deployed to devnet and website published.' |
| 83 | + }) |
0 commit comments