CI-Deploy #1
Workflow file for this run
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: CI-Deploy | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [master] | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy-contracts: | |
| if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Deploy') | |
| runs-on: ubuntu-latest | |
| environment: dev | |
| env: | |
| ENVIRONMENT: dev | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: master | |
| - name: Start Geth Devnet | |
| run: | | |
| docker compose up -d | |
| echo "Waiting for Geth JSON-RPC..." | |
| until curl -s http://localhost:8545; do sleep 1; done | |
| - name: Install Node Modules | |
| working-directory: ./hardhat | |
| run: npm ci | |
| - name: Compile Contracts | |
| working-directory: ./hardhat | |
| run: npx hardhat compile | |
| - name: Deploy Contracts | |
| working-directory: ./hardhat | |
| run: npx hardhat ignition deploy ./ignition/modules/Lock.ts --network localhost | |
| - name: Test Contracts | |
| working-directory: ./hardhat | |
| run: npx hardhat test --network localhost | |
| - name: Autotag | |
| id: autotag | |
| uses: anothrNick/github-tag-action@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| WITH_V: false | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Docker metadata | |
| id: metadata | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }} | |
| - name: Fix devnet folder permissions | |
| run: | | |
| sudo chown -R $(id -u):$(id -g) devnet | |
| sudo chmod -R u+rwX devnet | |
| - name: Build and push to Docker Hub | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile.contracts | |
| push: true | |
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-contracts-latest,${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-contracts-${{ steps.autotag.outputs.tag }} | |
| labels: ${{ steps.metadata.outputs.labels }} | |