Merge pull request #173 from 3mdeb/develop #131
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: GitHub Pages | |
on: | |
push: | |
branches: | |
- main # Set a branch name to trigger deployment | |
- develop | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-22.04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
environment: prod | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
- name: Setup Node | |
uses: actions/[email protected] | |
with: | |
node-version: 20 | |
- name: Setup Hugo | |
uses: peaceiris/[email protected] | |
with: | |
hugo-version: "0.111.3" | |
extended: true | |
- name: Setup Env | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
echo 'On main branch - setting URLs to production...' | |
sed -e 's/https:\/\/beta.3mdeb.com/https:\/\/3mdeb.com/g' -i config/_default/config.toml | |
sed -e 's/\[Beta\] //g' -i config/_default/config.toml | |
- name: Build | |
run: | | |
echo 'Building from branch: ${GITHUB_REF}' | |
npm install && hugo --minify | |
- name: Install sshpass | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y sshpass | |
- name: Deploy | |
env: | |
FTP_DIR_PROD: ${{ secrets.FTP_DIR_PROD }} | |
FTP_DIR_DEV: ${{ secrets.FTP_DIR_DEV }} | |
FTP_LOGIN: ${{ secrets.FTP_LOGIN }} | |
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} | |
FTP_DOMAIN: ${{ secrets.FTP_DOMAIN }} | |
run: cd ${GITHUB_WORKSPACE}/scripts && bash deploy.sh |