Skip to content

Merge pull request #47 from illacloud/fix/path_error #13

Merge pull request #47 from illacloud/fix/path_error

Merge pull request #47 from illacloud/fix/path_error #13

Workflow file for this run

name: Deploy to k8s
on:
push:
branches:
- main
- beta
- develop
permissions:
contents: write
env:
DO_CLUSTER: ${{ secrets.DO_CLUSTER }}
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_PWD: ${{ secrets.DOCKER_PWD }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_BOT_TOKEN }}
jobs:
deploy:
name: Deploy to k8s
runs-on: ubuntu-latest
environment:
name:
${{ (github.ref == 'refs/heads/main') && 'production' || (github.ref ==
'refs/heads/develop') && 'test' || (github.ref == 'refs/heads/beta') &&
'beta' }}
env:
ILLA_APP_ENV: ${{ vars.ILLA_APP_ENV }}
ILLA_URL: "https://illacloud.com"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Crowdin CLI
run: npm i -g @crowdin/cli
- name: Check Crowdin
run: crowdin -V
- uses: pnpm/action-setup@v2
with:
version: 8.7.0
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Write translations
run: pnpm run write-translations
- name: Upload translations
run: crowdin upload
- name: Download translations
run: crowdin download
- name: Build website
run: pnpm build
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DO_TOKEN }}
- name: Install kubectl
run: |
sudo snap install kubectl --classic
- name: Setup kubectl
run: |
doctl kubernetes cluster kubeconfig save $DO_CLUSTER
kubectl version
- name: Build Docker
run: |
docker build --cache-from=illa-website-frontend -f Dockerfile -t illa-website-frontend .
- name: Push application Docker image
run: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PWD
docker tag illa-website-frontend "illasoft/illa-website-frontend:$GITHUB_REF_NAME"
docker push "illasoft/illa-website-frontend:$GITHUB_REF_NAME"
- uses: actions/checkout@v4
with:
repository: illacloud/k8s-application-do
token: ${{ secrets.ILLA_BOT_TOKEN }}
path: k8s-application-do
- name: Deploy to Kubernetes
run: |
cd k8s-application-do/namespace-$ILLA_APP_ENV
kubectl apply -f ./illa-website-frontend/ -n $ILLA_APP_ENV
kubectl rollout restart deployment illa-website-frontend -n $ILLA_APP_ENV