Build news-and-ideas #1849
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: Build news-and-ideas | |
on: | |
push: | |
schedule: | |
- cron: '5 1 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
env: | |
HUGO_VERSION: "0.92.1" | |
steps: | |
- name: Prepare env | |
run: | | |
HUGO_TAR="hugo_${HUGO_VERSION}_Linux-64bit.tar.gz" | |
HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_TAR}" | |
echo "HUGO_TAR=${HUGO_TAR}" >> $GITHUB_ENV | |
echo "HUGO_URL=${HUGO_URL}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
- name: Setup hugo | |
run: | | |
cd ${GITHUB_WORKSPACE}/blog | |
wget ${HUGO_URL} | |
tar xf ${HUGO_TAR} | |
- name: Build | |
run: cd ${GITHUB_WORKSPACE}/scripts && bash build.sh | |
- name: Save artifacts | |
uses: actions/[email protected] | |
with: | |
name: static-content | |
path: | | |
scripts/deploy.sh | |
blog/public/ | |
include-hidden-files: true | |
deploy: | |
needs: [build] | |
runs-on: ubuntu-20.04 | |
if: | |
contains(' | |
refs/heads/master | |
refs/heads/develop | |
refs/heads/github_actions | |
', github.ref) | |
environment: prod | |
steps: | |
- name: Install sshpapass | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y sshpass | |
- name: Download artifacts | |
uses: actions/[email protected] | |
with: | |
name: static-content | |
- name: Deploy to FTP | |
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 |