Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Core Deployment

Core Deployment #37

Workflow file for this run

name: Core Deployment
on:
workflow_dispatch:
inputs:
bump_type:
description: 'Version Bump Type'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch
- prepatch
- preminor
- premajor
- prerelease
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
repository: cnstr/core
ref: main
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Configure Caching
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: cnstr-core-buildx-${{ github.sha }}
restore-keys: |
cnstr-core-buildx-
- name: Configure Rust and Cargo
uses: dtolnay/rust-toolchain@stable
- name: Configure Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Configure PNPM and install dependencies
uses: pnpm/action-setup@v2
with:
version: 8
run_install: |
- args: [--frozen-lockfile]
- name: Configure Docker
uses: docker/setup-buildx-action@v2
with:
version: latest
platforms: linux/amd64
- name: Login to tale.me
uses: docker/login-action@v2
with:
registry: us-east4-docker.pkg.dev
username: _json_key_base64
password: ${{ secrets.SERVICE_ACCOUNT }}
- name: Update npm versions and set build-time variables
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
pnpm np --no-cleanup --no-tests --no-publish --no-release-draft --yolo --message 'chore: v%s' $BUMP_TYPE
echo "git_version=$(jq -r '.version' package.json)" >> $GITHUB_ENV
echo "git_state=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "build_date=$(date --rfc-3339=date)" >> $GITHUB_ENV
env:
BUMP_TYPE: ${{ inputs.bump_type }}
- name: Load manifest.yaml for Core
run: echo "$MANIFEST_BASE64" | base64 -d > manifest.yaml
env:
MANIFEST_BASE64: ${{ secrets.CORE_MANIFEST }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Configure Docker
uses: docker/setup-buildx-action@v2
with:
version: latest
platforms: linux/amd64
- name: Build us-east4-docker.pkg.dev/aarnavtale/canister/core
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: us-east4-docker.pkg.dev/aarnavtale/canister/core:${{ env.git_version }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-to,mode=max
platforms: linux/amd64
build-args: |
BUILD_DATE=${{ env.build_date }}
VERSION=${{ env.git_version }}
GIT_STATE=${{ env.git_state }}
- name: Update Caching Layers
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-to /tmp/.buildx-cache
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
repository: cnstr/core
ref: main
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Configure Kubernetes
uses: tale/kubectl-action@v1
with:
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
kubectl-version: v1.26.0
- name: Configure Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Configure PNPM and install dependencies
uses: pnpm/action-setup@v2
with:
version: 8
run_install: |
- args: [--frozen-lockfile]
- name: Retrieve PNPM store path
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Configure Caching
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm--
- name: Load manifest.yaml for Core
run: |
echo "$MANIFEST_BASE64" | base64 -d > manifest.yaml
echo "git_version=$(jq -r '.version' package.json)" >> $GITHUB_ENV
env:
MANIFEST_BASE64: ${{ secrets.CORE_MANIFEST }}
- name: Run deploy tool
run: pnpm run deploy
- name: Commit file changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: update manifests to ${{ env.git_version }}'
commit_author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
commit_options: '--no-verify --signoff'
file_pattern: 'kubernetes/core.yaml kubernetes/fast.yaml'
- name: Deploy Kubernetes manifests
run: kubectl apply -f kubernetes/core.yaml