[f] fix envsubst #33
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 to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: kube-dev | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '22' | |
- name: Install dependencies | |
run: npm install --prefix web | |
- name: Build the project | |
env: | |
VITE_IP_ADDRESS: ${{ secrets.BACK_IP }} | |
run: npm run build --prefix web | |
- name: Install envsubst | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gettext | |
- name: Set environment variables | |
run: | | |
export REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2) | |
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV | |
- name: Deploy to Kubernetes | |
run: | | |
envsubst < deploy.yaml | kubectl apply -f - | |
env: | |
REPO_NAME: ${{ env.REPO_NAME }} | |
- name: Copy files to the Kubernetes pod | |
run: | | |
POD_BASE_NAME="deploy-${REPO_NAME}" | |
POD_NAME=$(kubectl get pods -n actions-runner-system --selector=app=web-app -o jsonpath='{.items[?(@.metadata.name.startsWith("'"$POD_BASE_NAME"'"))].metadata.name}') | |
kubectl cp ./web/dist $POD_NAME:/usr/share/nginx/html -n actions-runner-system | |
env: | |
REPO_NAME: ${{ env.REPO_NAME }} |