From 015ec0e506f76610e8378a5ad223a9c0185f78c9 Mon Sep 17 00:00:00 2001 From: just-mitch <68168980+just-mitch@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:59:58 -0500 Subject: [PATCH] feat: deploy a network using master each night night (#10536) It uses our easiest release-candidate network configuration (rc-1.yaml) fix: #10474 fix: #10473 --- .github/workflows/devnet-deploy.yml | 2 -- .github/workflows/network-deploy.yml | 28 +++++++++++++++++++ .../workflows/nightly-masternet-deploy.yml | 23 +++++++++++++++ .github/workflows/release-please.yml | 1 + 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/nightly-masternet-deploy.yml diff --git a/.github/workflows/devnet-deploy.yml b/.github/workflows/devnet-deploy.yml index 4c4e5a7384f..31f710afe03 100644 --- a/.github/workflows/devnet-deploy.yml +++ b/.github/workflows/devnet-deploy.yml @@ -43,7 +43,6 @@ jobs: secrets: GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} - bootstrap-network: runs-on: ubuntu-latest needs: deploy-network @@ -130,4 +129,3 @@ jobs: --json | tee ./basic_contracts.json aws s3 cp ./basic_contracts.json ${{ env.CONTRACT_S3_BUCKET }}/devnet/basic_contracts.json - diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index 2d48e35c9e1..bb76c24a73d 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -25,6 +25,16 @@ on: required: false type: string default: "true" + run_terraform_destroy: + description: Whether to run terraform destroy before deploying + required: false + type: string + default: "false" + ref: + description: The branch name to deploy from + required: false + type: string + default: "master" secrets: GCP_SA_KEY: required: true @@ -47,6 +57,16 @@ on: description: Whether to respect the Terraform lock required: false default: "true" + run_terraform_destroy: + description: Whether to run terraform destroy before deploying + required: false + type: string + default: "false" + ref: + description: The branch name to deploy from + required: false + type: string + default: "master" jobs: network_deployment: @@ -71,6 +91,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref }} - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 @@ -116,6 +138,12 @@ jobs: -backend-config="bucket=${{ env.TF_STATE_BUCKET }}" \ -backend-config="prefix=network-deploy/${{ env.REGION }}/${{ env.CLUSTER_NAME }}/${{ env.NAMESPACE }}/terraform.tfstate" \ + - name: Terraform Destroy + working-directory: ./spartan/terraform/deploy-release + if: ${{ inputs.run_terraform_destroy == 'true' }} + run: | + terraform destroy -auto-approve + - name: Terraform Plan working-directory: ./spartan/terraform/deploy-release run: | diff --git a/.github/workflows/nightly-masternet-deploy.yml b/.github/workflows/nightly-masternet-deploy.yml new file mode 100644 index 00000000000..3c0271d565b --- /dev/null +++ b/.github/workflows/nightly-masternet-deploy.yml @@ -0,0 +1,23 @@ +name: Nightly masternet deploy +on: + schedule: + # Run the workflow every night at 2:00 AM UTC. + - cron: "0 2 * * *" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + deploy-network: + uses: ./.github/workflows/network-deploy.yml + with: + ref: master + namespace: masternet + values_file: rc-1.yaml + aztec_docker_image: aztecprotocol/aztec:master + deployment_mnemonic_secret_name: testnet-deployment-mnemonic + respect_tf_lock: "false" + run_terraform_destroy: "true" + secrets: + GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 434adbe69f7..3a0defae122 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -24,6 +24,7 @@ jobs: with: token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }} command: manifest + default-branch: ${{ env.BRANCH_NAME }} - name: Dispatch to publish Aztec packages workflow uses: benc-uk/workflow-dispatch@v1