Merge branch 'dev' #293
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: ci.uffs.cc | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
env: | |
BUILD_HOST: ci.uffs.cc | |
BUILD_WEB_DIRECTORY: /home/ccuffsci/ci.uffs.cc/practice-website-programa | |
BUILD_WEB_URL: https://ci.uffs.cc/practice-website-programa | |
jobs: | |
build-deploy-audit: | |
name: Build, deploy and audit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Prepare deploy server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ env.BUILD_HOST }} | |
username: ${{ secrets.CI_USERNAME }} | |
password: ${{ secrets.CI_PASSWORD }} | |
script: | | |
mkdir -p ${{ env.BUILD_WEB_DIRECTORY }}/${{ steps.extract_branch.outputs.branch }}/${{ github.sha }} | |
mkdir -p ${{ env.BUILD_WEB_DIRECTORY }}/${{ steps.extract_branch.outputs.branch }}/${{ github.sha }}/_report | |
- name: Build site in jekyll/builder container | |
run: | | |
docker run \ | |
-v ${{ github.workspace }}/src:/srv/jekyll -v ${{ github.workspace }}/src/_site:/srv/jekyll/_site \ | |
jekyll/builder:latest /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --future" | |
- name: Deploy site via SSH | |
uses: garygrossgarten/github-action-scp@release | |
with: | |
local: ${{ github.workspace }}/src/_site/ | |
remote: ${{ env.BUILD_WEB_DIRECTORY }}/${{ steps.extract_branch.outputs.branch }}/${{ github.sha }}/ | |
host: ${{ env.BUILD_HOST }} | |
username: ${{ secrets.CI_USERNAME }} | |
password: ${{ secrets.CI_PASSWORD }} | |
- name: Audit site performance | |
uses: jakejarvis/lighthouse-action@master | |
with: | |
url: ${{ env.BUILD_WEB_URL }}/${{ steps.extract_branch.outputs.branch }}/${{ github.sha }} | |
- name: Upload audit results as an artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: report | |
path: './report' | |
- name: Copy audit report to deploy server via SSH | |
uses: garygrossgarten/github-action-scp@release | |
with: | |
local: ${{ github.workspace }}/report | |
remote: ${{ env.BUILD_WEB_DIRECTORY }}/${{ steps.extract_branch.outputs.branch }}/${{ github.sha }}/_report/ | |
host: ${{ env.BUILD_HOST }} | |
username: ${{ secrets.CI_USERNAME }} | |
password: ${{ secrets.CI_PASSWORD }} | |
- name: Summary | |
run: | | |
echo "Summary:" | |
echo " Live URL: ${{ env.BUILD_WEB_URL }}/${{ steps.extract_branch.outputs.branch }}/${{ github.sha }}" | |
echo " Audit report URL: ${{ env.BUILD_WEB_URL }}/${{ steps.extract_branch.outputs.branch }}/${{ github.sha }}/_report" |