test cache speed #9
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: Deploy Docs (Production) | |
concurrency: documentation | |
on: | |
push: | |
branches: [master, gql, docs/init] | |
jobs: | |
build-push: | |
name: Build and Push Docs Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: docs | |
target: docs-prod | |
tags: ${{ secrets.DOCKER_USERNAME }}/bt-docs:prod | |
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/bt-docs:prod-cache | |
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/bt-docs:prod-cache,mode=max | |
platforms: linux/amd64 | |
push: true | |
deploy: | |
name: SSH and Deploy | |
needs: [build-push] | |
runs-on: ubuntu-latest | |
environment: documentation | |
steps: | |
- name: SSH and Helm Install | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
set -e # Exit immediately if a command fails | |
# Check if helm chart exists | |
helm status bt-prod-docs &>/dev/null && status=true || status=false | |
# Upgrade helm chart, or install if not exists | |
helm upgrade bt-prod-docs oci://registry-1.docker.io/octoberkeleytime/bt-docs \ | |
--install \ | |
--version=1.0.0 \ | |
--namespace=bt \ | |
--set host=docs.stanfurdtime.com \ | |
# Restart deployment if helm chart existed | |
if [ $status = true ]; then | |
kubectl rollout restart deployment bt-prod-docs-docs | |
fi | |
# Check container status | |
kubectl rollout status --timeout=180s deployment bt-prod-docs-docs |