From 695cf13523642c7a648635853c5480c9f01f9ff2 Mon Sep 17 00:00:00 2001 From: Misha Kolesnik Date: Thu, 21 Dec 2023 16:00:04 +0200 Subject: [PATCH] ci: add workflow for goerli deployments (#6) * ci: add workflow for goerli deployments * chore: remove temporary stubs --- .github/workflows/deploy-goerli.yml | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/deploy-goerli.yml diff --git a/.github/workflows/deploy-goerli.yml b/.github/workflows/deploy-goerli.yml new file mode 100644 index 000000000..b6b4b3df5 --- /dev/null +++ b/.github/workflows/deploy-goerli.yml @@ -0,0 +1,80 @@ +name: Deploy to Goerli + +on: + workflow_dispatch: + +permissions: + contents: read + id-token: write + deployments: write + +jobs: + init: + name: Set global version + runs-on: ubuntu-latest + outputs: + GLOBAL_VERSION: ${{ steps.set_vars.outputs.GLOBAL_VERSION }} + steps: + - name: Set global version + id: set_vars + run: echo "GLOBAL_VERSION=${{ github.sha }}" >> $GITHUB_OUTPUT + + build-and-test: + needs: [init] + name: Build + uses: ./.github/workflows/reusable-build-and-test.yml + secrets: inherit + with: + version: ${{ needs.init.outputs.GLOBAL_VERSION }} + + deploy-goerli: + needs: [init, build-and-test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: jkroepke/setup-vals@v1.1.3 + - name: Setup helmfile + uses: mamezou-tech/setup-helmfile@v1.3.0 + with: + install-kubectl: no + install-helm: no + additional-helm-plugins: https://github.com/jkroepke/helm-secrets --version v4.1.1,https://github.com/aslafy-z/helm-git --version 0.14.0 + - uses: google-github-actions/auth@v2 + with: + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - name: Set up GKE credentials + uses: google-github-actions/get-gke-credentials@v0.8.2 + with: + cluster_name: mangata-dev-alpha + location: europe-west1 + + - name: Create a GitHub Deployment + uses: bobheadxi/deployments@v1.4.0 + id: deployment + with: + step: start + token: ${{ secrets.GITHUB_TOKEN }} + env: goerli + ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} + + - run: | + export ENVIRONMENT=goerli + export IMAGE_TAG=${{ needs.init.outputs.GLOBAL_VERSION }} + + # https://dev.to/derlin/helmfile-difference-between-sync-and-apply-helm-3-28o1 + + export HELM_DIFF_THREE_WAY_MERGE=true + helmfile apply -e goerli + working-directory: ops/helmfiles + + - name: Update the GitHub Deployment status + uses: bobheadxi/deployments@v1.4.0 + if: always() + with: + step: finish + token: ${{ secrets.GITHUB_TOKEN }} + status: ${{ job.status }} + env: ${{ steps.deployment.outputs.env }} + deployment_id: ${{ steps.deployment.outputs.deployment_id }} + env_url: "https://eigen-operator-rpc-goerli.mangata.online"