Skip to content

[do not merge] Mainnet environment #4559

[do not merge] Mainnet environment

[do not merge] Mainnet environment #4559

Workflow file for this run

name: Dashboard CI/CD
on:
push:
paths-ignore:
- 'apps/console/**'
- 'deploy/helm/console/**'
- ".github/workflows/console-ci.yaml"
- 'apps/sandbox/**'
- 'deploy/helm/sandbox/**'
- ".github/workflows/sandbox-ci.yaml"
branches:
- main
pull_request:
paths-ignore:
- 'apps/console/**'
- 'deploy/helm/console/**'
- ".github/workflows/console-ci.yaml"
- 'apps/sandbox/**'
- 'deploy/helm/sandbox/**'
- ".github/workflows/sandbox-ci.yaml"
branches:
- main
release:
types:
- prereleased
- released
workflow_dispatch:
inputs:
ENVIRONMENT_NAME:
description: 'Environment Name'
required: true
default: enkinet
type: choice
options:
- enkinet
- hammunet
- gilganet
- mardunet
- dumunet
env:
active_network: 'mainnet'
prerelease_network: 'mainnet'
release_network: 'mainnet'
jenkins_job_name: 'kubernetes-deployments/job/dapps-dashboard'
helm_dir: 'deploy/helm/dashboard'
dev_eks_cluster: 'rdx-works-main-dev'
prod_eks_cluster: 'rtlj-prod'
permissions:
id-token: write
pull-requests: write
contents: read
deployments: write
packages: write
jobs:
trigger:
name: Check trigger
if: >
( github.event.action == 'prereleased' && contains( github.event.release.tag_name, 'dashboard') ) ||
( github.event.action == 'released' && contains( github.event.release.tag_name, 'dashboard') ) ||
( github.event_name == 'workflow_dispatch' ) ||
( github.ref == 'refs/heads/main' && github.event_name == 'push' ) ||
( github.event_name == 'pull_request' )
runs-on: ubuntu-latest
steps:
- name: Dump context
uses: RDXWorks-actions/ghaction-dump-context@master
- name: Info
run: |
echo "This is triggered by ${{ github.event_name }}." >> $GITHUB_STEP_SUMMARY
echo "Github action is ${{ github.event.action }}." >> $GITHUB_STEP_SUMMARY
build:
runs-on: selfhosted-ubuntu-22.04
needs:
- trigger
steps:
- uses: RDXWorks-actions/checkout@main
with:
fetch-depth: 0
- name: Dump context
uses: RDXWorks-actions/ghaction-dump-context@master
- uses: ./.github/actions/build
with:
active_network_name: ${{ env.active_network }}
release_network_name: ${{ env.release_network }}
- name: Turbo Worfkflow
run: npx turbo run db:generate lint prettier coverage svelte:check --filter=dashboard
setup-tags:
runs-on: ubuntu-latest
needs:
- trigger
steps:
- uses: RDXWorks-actions/checkout@main
with:
fetch-depth: 0
- name: Docker tags for dashboard
id: dashboard-tags
uses: RDXWorks-actions/metadata-action@master
with:
images: |
docker.io/radixdlt/dapps-dashboard
tags: |
type=sha,event=pr
type=sha,event=branch
type=semver,pattern={{version}}
- name: Docker tags for storybook
id: storybook-tags
uses: RDXWorks-actions/metadata-action@master
with:
images: |
docker.io/radixdlt/dapps-dashboard-storybook
tags: |
type=sha,event=pr
type=sha,event=branch
type=semver,pattern={{version}}
- name: Define network name
run: |
if [ "${{ github.event_name}}" = 'workflow_dispatch' ]; then
echo "NETWORK_NAME="${{ github.event.inputs.ENVIRONMENT_NAME }}"" >> $GITHUB_ENV
elif [ "${{ github.event.action }}" = "released" ]; then
echo "NETWORK_NAME=${{ env.release_network }}" >> $GITHUB_ENV
elif [ "${{ github.event.action }}" = "prereleased" ]; then
echo "NETWORK_NAME=${{ env.prerelease_network }}" >> $GITHUB_ENV
elif [ "${{ github.ref }}" = "refs/heads/main" -a "${{ github.event_name }}" = 'push' ] || [ "${{ github.event_name }}" = "pull_request" ]; then
echo "NETWORK_NAME=${{ env.active_network }}" >> $GITHUB_ENV
fi
- id: network
run: |
echo "network-name=${{ env.NETWORK_NAME }}" >> $GITHUB_OUTPUT
- id: tag-with-network
run: |
echo "tag-with-network=${{github.sha}}-${{ env.NETWORK_NAME }}" >> $GITHUB_OUTPUT
- run: |
echo "$GITHUB_OUTPUT"
outputs:
dashboard-tags: ${{ steps.dashboard-tags.outputs.tags }}
dashboard-labels: ${{ steps.dashboard-tags.outputs.labels }}
dashboard-json: ${{ steps.dashboard-tags.outputs.json }}
storybook-tags: ${{ steps.storybook-tags.outputs.tags }}
storybook-labels: ${{ steps.storybook-tags.outputs.labels }}
storybook-json: ${{ steps.storybook-tags.outputs.json }}
tag-with-network: ${{steps.tag-with-network.outputs.tag-with-network}}
network-name: ${{steps.network.outputs.network-name}}
push-dashboard:
name: (PRIVATE) Dashboard docker AMD
needs:
- setup-tags
uses: radixdlt/public-iac-resuable-artifacts/.github/workflows/docker-build.yml@main
with:
runs_on: selfhosted-ubuntu-22.04
image_registry: 'docker.io'
image_organization: 'radixdlt'
target: 'dashboard'
image_name: 'dapps-dashboard'
tag: ${{ needs.setup-tags.outputs.tag-with-network }}
context: './'
dockerfile: './Dockerfile'
platforms: 'linux/amd64'
scan_image: false
with_sbom: false
provenance: false
snyk_target_ref: ${{ github.ref_name }}
build-args: |
NETWORK_NAME=${{ needs.setup-tags.outputs.network-name }}
NPM_LOCAL_CACHE=.cache/
deploy_pull_request:
if: ${{ github.event.pull_request }}
name: Deploy PR
needs:
- push-dashboard
- setup-tags
uses: radixdlt/public-iac-resuable-artifacts/.github/workflows/jenkins-deployment.yml@main
with:
jenkins_job_name: "kubernetes-deployments/job/dapps-dashboard"
github_branch: "${{ github.head_ref }}"
application_name: "dashboard"
hierarchical_namespace: "dashboard-ci-pr"
create_subnamespace: "true"
kubernetes_namespace: "dashboard-pr-${{ github.event.number }}"
aws_eks_cluster: "rdx-works-main-dev"
aws_iam_role_name: "jenkins-dashboard-pr-deployer"
helm_dir: "deploy/helm/dashboard"
helmfile_environment: "pr"
helmfile_extra_vars: "ci.tag=${{ needs.setup-tags.outputs.tag-with-network }},ci.prNumber=${{ github.event.number }}"
secrets:
aws_deployment_account_id: ${{ secrets.AWS_DEV_ACCOUNT_ID }}
secrets_account_id: ${{ secrets.SECRETS_ACCOUNT_ID }}