Deploy Live Previews #1
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 Live Previews | |
on: | |
workflow_dispatch: | |
jobs: | |
next-live-preview: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref }}-next-documentation-live-preview | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Workflow run cleanup action | |
uses: rokroskar/workflow-run-cleanup-action@v0.2.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: live previews docker build | |
uses: docker/build-push-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
registry: ghcr.io | |
repository: refinedev/refine/refine-live-preview | |
dockerfile: packages/live-previews/Dockerfile | |
tag_with_sha: true | |
- name: Set up kubectl | |
uses: matootie/dokube@v1.3.4 | |
with: | |
personalAccessToken: ${{ secrets.DIGITALOCEAN_TOKEN }} | |
clusterName: pankod-k8s | |
expirationTime: 1200 | |
- name: Get nodes | |
run: kubectl get nodes | |
- name: Deploy refine-live-previews-documentation to k8s | |
run: | | |
cd packages/live-previews | |
mv ./k8s/live-previews/Chart.yaml ./k8s/live-previews/Chart.old.yaml && | |
cat ./k8s/live-previews/Chart.old.yaml | grep -v appVersion > ./k8s/live-previews/Chart.yaml && | |
echo -e "\r\nappVersion: sha-${GITHUB_SHA::7}\r\n" >> ./k8s/live-previews/Chart.yaml && | |
cat ./k8s/live-previews/Chart.yaml | |
helm upgrade refine-next-live-previews-documentation ./k8s/live-previews --install --atomic --timeout 20m0s --values=./k8s/live-previews/values.yaml \ | |
--set replicaCount=3 \ | |
--set ingress.enabled=true \ | |
--set ingress.annotations."kubernetes\.io/ingress\.class"=nginx \ | |
--set ingress.annotations."cert-manager\.io/issuer"=letsencrypt-prod \ | |
--set ingress.hosts[0].host=${{ env.domain }} \ | |
--set ingress.hosts[0].paths[0].path="/" \ | |
--set ingress.hosts[0].paths[0].pathType=ImplementationSpecific \ | |
--set ingress.tls[0].secretName=${{ env.domain }} \ | |
--set ingress.tls[0].hosts[0]=${{ env.domain }} \ | |
env: | |
domain: "next.live-previews.refine.dev" |