chore: update #22
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
name: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '21' | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: Install dependencies | |
run: | | |
npm i pnpm -g | |
pnpm -v | |
pnpm config set store-dir .pnpm-store | |
pnpm i | |
cd apps/bodhi-service | |
pnpm i | |
- name: Build | |
run: | | |
cd apps/bodhi-service | |
pnpm run build | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: apps/bodhi-service | |
file: apps/bodhi-service/Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ghcr.io/isnolan/bodhi:service-${{ github.run_id }} | |
- name: Docker logout | |
run: docker logout | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to Kubernetes | |
run: | | |
curl -X PUT -H "content-type:application/json" -H "Cookie:KuboardUsername=${KuboardUsername};KuboardAccessKey=${KuboardAccessKey}" -d '{"kind":"deployments","namespace":"draft","name":"bodhi-service","images":{"ghcr.io/isnolan/bodhi":"ghcr.io/isnolan/bodhi:service-${{ github.run_id }}"}}' https://kuboard.devflow.ltd/kuboard-api/cluster/Test/kind/CICDApi/admin/resource/updateImageTag | |
env: | |
KuboardUsername: ${{ secrets.KUBOARD_USER }} | |
KuboardAccessKey: ${{ secrets.KUBOARD_KEY }} |