Skip to content

docs(side navigation): initial build of the side navigation #41

docs(side navigation): initial build of the side navigation

docs(side navigation): initial build of the side navigation #41

name: Deploy guidance site to production
on:
workflow_dispatch:
pull_request:
branches: [ main ]
push:
branches: [ main ]
env:
GITHUB_DEPLOY_KEY: ${{ secrets.GH_DEPLOY_KEY }}
ECR_NAME: ${{ secrets.ECR_NAME }}
KUBE_CLUSTER: ${{ secrets.KUBE_CLUSTER }}
KUBE_NAMESPACE: ${{ secrets.KUBE_NAMESPACE }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: npm ci
- run: npm run build:package
- uses: actions/upload-artifact@v4
with:
name: mojds-package
path: package
- run: npm run build:dist
- run: npm run build:docs
- uses: actions/upload-artifact@v4
with:
name: mojds-dist
path: dist
test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x, 21.x, 22.x]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: mojds-package
path: package
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Test Sass can be compiled
run: npm run test:sass
deploy:
runs-on: ubuntu-latest
needs: [build, test]
if: github.event_name == 'push'
permissions:
id-token: write
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ECR_ROLE_TO_ASSUME }}
aws-region: ${{ vars.ECR_REGION }}
- uses: aws-actions/amazon-ecr-login@v2
id: login-ecr
- run: |
docker build --build-arg GITHUB_DEPLOY_KEY="${GITHUB_DEPLOY_KEY}" --target=production -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
cat kubernetes-deploy-production.tpl | envsubst > kubernetes-deploy-production.yaml
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ vars.ECR_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }}
BRANCH: "production"
- run: |
echo "${KUBE_CERT}" > ca.crt
kubectl config set-cluster ${KUBE_CLUSTER} --certificate-authority=./ca.crt --server=https://${KUBE_CLUSTER}
kubectl config set-credentials deploy-user --token=${KUBE_TOKEN}
kubectl config set-context ${KUBE_CLUSTER} --cluster=${KUBE_CLUSTER} --user=deploy-user --namespace=${KUBE_NAMESPACE}
kubectl config use-context ${KUBE_CLUSTER}
kubectl -n ${KUBE_NAMESPACE} apply -f kubernetes-deploy-production.yaml
env:
KUBE_CERT: ${{ secrets.KUBE_CERT }}
KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }}
KUBE_CLUSTER: ${{ secrets.KUBE_CLUSTER }}