Skip to content

Move AuctionsUI Staging to GHA and ArgoCD #3

Move AuctionsUI Staging to GHA and ArgoCD

Move AuctionsUI Staging to GHA and ArgoCD #3

name: Deploy Auctions UI staging
on:
pull_request:
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: 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 }}
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: Update Auctions-UI Value File for hardhat
# 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-hardhat.yml"
# - name: Update Auctions-UI Value File for core
# 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-core.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