Seyyed Ali Mohammadiyeh (Max Base) Vue.js Global Summit 25 - May 21, 2025
Seyyed Ali Mohammadiyeh (Max Base) Open-source Maintainer, GitHub Senior Software Engineer CTO, asrez maxbasecode@gmail.com
Learn how to create a reliable, automated CI/CD pipeline for your Vue.js applications using GitHub Actions.
Real-world CI/CD workflows Demo-ready GitHub Actions templates Deployment strategies + secrets management
GitHub actions files are located in .github/workflows/ directory.
.github/workflows/
.vue-project/ βββ .github/workflows/ β βββ deploy.yml βββ src/ βββ public/ βββ vite.config.ts βββ package.json
# .github/workflows/deploy.yml name: Vue CI/CD on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' - run: npm ci - run: npm run build
Lint β Test β Build β Deploy
- run: npm run lint - run: npm run test
Make sure you have scripts in package.json:
package.json
"scripts": { "lint": "eslint .", "test": "vitest" }
${{ secrets.YOUR_SECRET }}
You can find settings of your repository at top of your repository page:
In settings page, you can find Actions in the left sidebar:
In settings actions envirnment variable, you can manage and add/edit/delete your secret variables:
Sometime you need write access inside your github actions, in this case you need to check and enable it in repository settings:
Letβs walk through a real Vue project using GitHub Actions end-to-end:
Build β Connect β Deploy
Let's do it one by one.
For your local machine:
{ "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview", "deploy": "vite build && gh-pages -d dist" } }
For GitHub Actions:
{ "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview", "deploy": "vite build && gh-pages -d dist -u 'Max Base (Seyyed Ali Mohammadiyeh) <maxbasecode@gmail.com>' -r https://x-access-token:${GITHUB_TOKEN}@github.com/BaseMax/vuejs-cicd-deploy-on-github-pages.git" } }
name: Deploy project in GitHub Pages on: push: branches: [ main ] jobs: gh-pages-deploy: name: Deploying code to gh-pages branch runs-on: ubuntu-latest steps: - name: Checkout code from repository uses: actions/checkout@v4 - name: Setup Node version uses: actions/setup-node@v4 with: node-version: 20.x - name: Install dependencies run: npm install
- name: Setup git user run: | git config user.name "Max Base (Seyyed Ali Mohammadiyeh)" git config user.email "maxbasecode@gmail.com" - name: Deploy project run: npm run deploy env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Deploy project to SFTP server on: push: branches: [ main ] jobs: sftp-deploy: name: Deploying to SSH SFTP runs-on: ubuntu-latest steps: - name: Checkout code from repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20.x - name: Install dependencies run: npm install - name: Build project run: npm run build
- name: Install sshpass run: sudo apt-get install -y sshpass - name: Upload dist folder to remote SFTP server run: | sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no -P ${{ secrets.SSH_PORT }} -r dist/* ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_IP }}:${{ secrets.SSH_PATH }}
After running the deployment, you can ese directory, and files all created in your server via SSH:
Envirnment variables for this SSH github actions:
name: Deploy project via FTP to cPanel on: push: branches: [ main ] jobs: ftp-deploy: name: Deploying via FTP to cPanel runs-on: ubuntu-latest steps: - name: Checkout code from repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20.x - name: Install dependencies run: npm install - name: Build project run: npm run build - name: Install lftp run: sudo apt-get install -y lftp
- name: Upload via FTP with custom port run: | lftp -u "${{ secrets.FTP_USERNAME }},${{ secrets.FTP_PASSWORD }}" -p ${{ secrets.FTP_PORT }} ${{ secrets.FTP_HOST }} -e " set dns:order inet; set ftp:ssl-allow no; set ssl:verify-certificate no; mirror -R -e -n dist ${{ secrets.FTP_PATH }}; bye "
Envirnment variables for this FTP github actions:
Here is filemanager in our host before running the github actions:
- uses: actions/cache@v3 with: path: ~/.npm key: npm-${{ hashFiles('package-lock.json') }}
- name: Health Check run: curl --fail https://example.com || exit 1
on: [push] jobs: lint: ... test: ... build: ... deploy: ...
Open-Source repositories:
github.com/basemax maxbasecode@gmail.com Happy Coding!