Remove test styling and update kubectl command #14
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: Design system deployment | |
on: | |
push: | |
branches: | |
# TODO: Change to 'main' once tested and released | |
- 'frontend-rework' | |
paths: | |
- 'public/app/frontend/**' | |
jobs: | |
storybook-deploy: | |
runs-on: ubuntu-latest | |
environment: design-system | |
permissions: | |
id-token: write | |
contents: read | |
defaults: | |
run: | |
working-directory: './public/app/frontend' | |
steps: | |
- name: 'Manual checkout' | |
uses: actions/checkout@v4 | |
- name: 'Set up Node' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: 'Install Node' | |
run: npm install | |
- name: 'Build Node' | |
shell: bash | |
run: npm run build-storybook | |
- name: "Authenticate to the cluster" | |
env: | |
KUBE_CERT: ${{ secrets.KUBE_CERT }} | |
KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }} | |
KUBE_CLUSTER: ${{ secrets.KUBE_CLUSTER }} | |
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} | |
- name: "Copy files to service pod" | |
env: | |
SERVICE_POD: ${{ secrets.SERVICE_POD }} | |
run: | | |
kubectl -n ${KUBE_NAMESPACE} cp ./public/app/frontend/storybook-static ${SERVICE_POD}:/tmp/storybook-static | |
- name: "Sync to S3" | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
SERVICE_POD: ${{ secrets.SERVICE_POD }} | |
run: | | |
kubectl exec -n ${KUBE_NAMESPACE} -it pod/${SERVICE_POD} -- aws s3 sync /tmp/storybook-static s3://${AWS_S3_BUCKET} --follow-symlinks --delete |