-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DevOps: Move AuctionsUI Staging to GHA and ArgoCD (#607)
Co-authored-by: valia fetisov <[email protected]>
- Loading branch information
1 parent
6aa8178
commit 3596555
Showing
5 changed files
with
453 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: Deploy Auctions UI staging | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
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/main.auction-ui.k8s.sidestream.tech/frontend/rpc_url = RPC_URL, /auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/contact_email = CONTACT_EMAIL, /auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/frontend_origin = FRONTEND_ORIGIN, /auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/infura_project_id = INFURA_POJECT_ID, /auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/heapio_id = HEAPIO_ID, /auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/production_domain = PRODUCTION_DOMAIN, /auction-ui/main.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 staging 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/staging/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/staging/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 |
Oops, something went wrong.