Skip to content

Deploy Auctions UI production #2

Deploy Auctions UI production

Deploy Auctions UI production #2

name: Deploy Auctions UI production
on:
release:
types: [released]
jobs:
build-frontend:
name: build frontend
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_WORKFLOW_USER }}
password: ${{ secrets.GH_WORKFLOW_TOKEN }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-central-1
role-to-assume: arn:aws:iam::802385070966:role/GithubActionsSSMRole
role-session-name: AuctionsUiSession
- name: Get secrets from parameterstore
uses: dkershner6/aws-ssm-getparameters-action@v2
with:
parameterPairs: "/auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/rpc_url = RPC_URL, /auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/contact_email = CONTACT_EMAIL, /auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/frontend_origin = FRONTEND_ORIGIN, /auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/infura_project_id = INFURA_POJECT_ID, /auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/heapio_id = HEAPIO_ID, /auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/production_domain = PRODUCTION_DOMAIN, /auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/staging_banner_url = STAGING_BANNER_URL"
withDecryption: "true"
- name: Set outputs
id: vars
run: echo "git_hash_short=$(git rev-parse --short ${GITHUB_SHA})" >> $GITHUB_OUTPUT
- name: build and push frontend
uses: docker/build-push-action@v6
with:
file: frontend/Dockerfile
context: ./
platforms: linux/amd64
tags: |
ghcr.io/sidestream-tech/unified-auctions-ui/frontend:${{ github.sha }}
build-args: |
RPC_URL=${{ env.RPC_URL }}
PRODUCTION_DOMAIN=${{ env.PRODUCTION_DOMAIN }}
CONTACT_EMAIL=${{ env.CONTACT_EMAIL }}
STAGING_BANNER_URL=${{ env.STAGING_BANNER_URL }}
HEAPIO_ID=${{ env.HEAPIO_ID }}
FRONTEND_ORIGIN=${{ env.FRONTEND_ORIGIN }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-bot:
name: build bot
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_WORKFLOW_USER }}
password: ${{ secrets.GH_WORKFLOW_TOKEN }}
- name: Set outputs
id: vars
run: echo "git_hash_short=$(git rev-parse --short ${GITHUB_SHA})" >> $GITHUB_OUTPUT
- name: build and push bot
uses: docker/build-push-action@v6
with:
file: bot/Dockerfile
context: ./
platforms: linux/amd64
tags: |
ghcr.io/sidestream-tech/unified-auctions-ui/bot:${{ github.sha }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
name: deploy production to cluster
needs:
- build-frontend
- build-bot
runs-on: ubuntu-latest
steps:
- name: Checkout k8s-projects Repo
uses: actions/checkout@v4
with:
repository: sidestream-tech/k8s-projects
token: ${{ secrets.GH_WORKFLOW_TOKEN }}
path: k8s-projects
ref: main
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 6
- name: Update Auctions-UI Value File for frontend
uses: mikefarah/yq@master
with:
cmd: yq -i '(.image.tag ="${{ github.sha }}") | (.commitShortSHA ="${{ github.sha }}") | (.releaseTag ="${{ github.ref_name }}")' $VALUES_FILE
env:
VALUES_FILE: "k8s-projects/auctions-ui/production/values-frontend.yml"
- name: Update Auctions-UI Value File for bot
uses: mikefarah/yq@master
with:
cmd: yq -i '(.image.tag ="${{ github.sha }}") | (.commitShortSHA ="${{ github.sha }}") | (.releaseTag ="${{ github.ref_name }}")' $VALUES_FILE
env:
VALUES_FILE: "k8s-projects/auctions-ui/production/values-bot.yml"
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GH_WORKFLOW_TOKEN }}
repository: sidestream-tech/k8s-projects
branch: main
message: "[ArgoCD]: ${{ github.workflow }} to `${{ steps.short-sha.outputs.sha }}` :rocket:"
directory: k8s-projects