Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add workflow for goerli deployments #6

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/deploy-goerli.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
- name: Setup helmfile
uses: mamezou-tech/[email protected]
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/[email protected]
with:
cluster_name: mangata-dev-alpha
location: europe-west1

- name: Create a GitHub Deployment
uses: bobheadxi/[email protected]
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/[email protected]
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"
Loading