From a9f14f926e8f807774523717f5e3eb6b68849ac5 Mon Sep 17 00:00:00 2001 From: Denis Baryshev Date: Mon, 15 Mar 2021 11:46:44 +0300 Subject: [PATCH] add new build-and-deploy initial CI job --- .github/workflows/build-and-deploy.yml | 92 +++++++++++++++++++ .github/workflows/{ci.yml => ci.oyml} | 0 .../{promote-stage.yml => promote-stage.oyml} | 0 3 files changed, 92 insertions(+) create mode 100644 .github/workflows/build-and-deploy.yml rename .github/workflows/{ci.yml => ci.oyml} (100%) rename .github/workflows/{promote-stage.yml => promote-stage.oyml} (100%) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml new file mode 100644 index 0000000000..ca9edd8dab --- /dev/null +++ b/.github/workflows/build-and-deploy.yml @@ -0,0 +1,92 @@ +name: Build and Deploy + +on: + deployment: + + # push: + # branches: + # - ci-github-deployments + +env: + DEPLOY_APPS: -l name=server -l name=prover -l name=explorer + +jobs: + pre: + runs-on: [k8s, stage] + if: github.ref == 'refs/tags/v-test' + + steps: + - uses: actions/checkout@v2 + - id: print + run: | + echo "::set-output name=shortRev::$(git rev-parse --short HEAD)" + + outputs: + shortRev: ${{ steps.print.outputs.shortRev }} + + build-images: + name: Build and Push Docker Images + runs-on: [self-hosted, MAIN] + needs: pre + + ## Required services + # services: + # postgres: + # image: postgres:10.4 + # ports: + # - 5432:5432 + + steps: + - run: echo 'Building image' + # - uses: actions/checkout@v2 + + # - name: setup-env + # run: | + # echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV + # echo CI=1 >> $GITHUB_ENV + # echo $(pwd)/bin >> $GITHUB_PATH + # - name: init + # run: | + # cargo sqlx --version || cargo install --version=0.2.0 sqlx-cli + # zk + # zk run yarn + # cp etc/tokens/{test,localhost}.json + # zk run verify-keys unpack + # zk db basic-setup + # - name: update-images + # run: | + # docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} + # zk docker push rust + # zk docker push nginx + # echo IMAGE_TAG=$(git rev-parse --short HEAD) >> $GITHUB_ENV + + deploy: + name: Deploy to the Stage enviroment + runs-on: [k8s, deployer, testnet] + needs: build-images + + container: + image: dysnix/kubectl:v1.16-gcloud + + env: + KUBECONF: ${{ secrets.KUBECONF_TESTNET }} + + steps: + - + name: Create ~/.kube/config + run: mkdir -p ~/.kube && echo $KUBECONF | base64 -d > ~/.kube/config + - + name: Clone helm-infra + uses: actions/checkout@v2 + with: + repository: matter-labs/helm-infra + path: helm-infra + ref: master + token: ${{ secrets.GH_TOKEN }} + - + name: Deploy apps + run: | + # UPDATE_REPOS=y helmfile -e $HFENV repos + + echo helmfile -e $HFENV $DEPLOY_APPS \ + list # --args "timeout 180s" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.oyml similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows/ci.oyml diff --git a/.github/workflows/promote-stage.yml b/.github/workflows/promote-stage.oyml similarity index 100% rename from .github/workflows/promote-stage.yml rename to .github/workflows/promote-stage.oyml