adding deployment #67
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: Resume Actions | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
Check_Files_Diff: | |
# Check what files were added | |
name: Chceking Commits π | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Check Modified Files | |
id: check_files | |
run: | | |
echo "=============== list modified files ===============" | |
git diff --name-only HEAD^ HEAD | |
echo "========== check paths of modified files ==========" | |
git diff --name-only HEAD^ HEAD > files.txt | |
while IFS= read -r file | |
do | |
echo $file | |
if [[ $file != 'resume.yml' ]]; then | |
echo "Modified files are not important to updating the docs/resume.index" | |
echo "::set-output name=run_job::false" | |
break | |
else | |
echo "::set-output name=run_job::true" | |
fi | |
done < files.txt | |
Repo_Linting: | |
# Verify json.yml and workflow conform to yaml linting | |
name: Repo Linting π§ | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Install YAML Lint | |
run: pip install yamllint | |
- name: Lint YAML files | |
run: yamllint -c .yamlignore.yml resume.yml .github/workflows | |
Build-Resume-JSON: | |
# Convert json.yml into JSON format && Load into an artifact | |
name: Building resume.json π§ | |
needs: Check_Files_Diff | |
# if: needs.Check_Files_Diff.outputs.run_job == 'true' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Install requirements.txt | |
run: pip install -r ${{ github.workspace }}/requirements.txt | |
- name: Convert 'resume.yml' to 'resume.json' | |
run: cat ${{ github.workspace }}/resume.yml | yq > ${{ github.workspace }}/resume.json | |
- name: Create JSON Resume Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: resume.json | |
path: ${{ github.workspace }}/resume.json | |
Verify-JSON: | |
# Verify converted resume.json formats to JSON-Resume's syantax | |
name: JSON Syantax Inspect π¬ | |
needs: [Build-Resume-JSON, Check_Files_Diff] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download the resume artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: resume.json | |
- name: Install Resume CLI | |
run: npm install -g resume-cli | |
- name: Validate Resume Schema | |
run: resume validate resume.json | |
Convert-Resume-HTML: | |
# Building HTML and PDF artifacts | |
name: Converting to HTML π | |
needs: [Build-Resume-JSON, Verify-JSON] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download the resume artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: resume.json | |
- name: Install Resume CLI | |
run: npm install -g resume-cli | |
- name: Install Resume Themes | |
run: npm install jsonresume-theme-even jsonresume-theme-eddywashere | |
- name: Convert Resume to HTML | |
run: resume export resume.html --theme eddywashere --resume resume.json --format html | |
- name: Create HTML Resume Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: resume.html | |
path: ${{ github.workspace }}/resume.html | |
Convert-Resume-PDF: | |
# Building PDF artifacts | |
name: Building PDF Artifact πΎ | |
needs: [Build-Resume-JSON, Verify-JSON] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download the resume artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: resume.json | |
- name: Install Resume CLI | |
run: npm install -g resume-cli | |
- name: Install Resume Themes | |
run: npm install jsonresume-theme-even jsonresume-theme-eddywashere | |
- name: Convert Resume to PDF | |
# run: resume export resume.html --theme eddywashere --resume resume.json --format html | |
run: resume export resume.pdf --resume resume.json --format pdf | |
- name: Create PDF Resume Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: resume.pdf | |
path: ${{ github.workspace }}/resume.pdf | |
Deploy-To-Public-GIST: | |
name: Updating Index.html π | |
needs: [Build-Resume-JSON] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download the resume artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: resume.json | |
- name: Deploy | |
uses: exuanbo/actions-deploy-gist@v1 | |
with: | |
token: ${{ secrets.TOKEN }} | |
gist_id: 91db4ee7d322c69ed3131fd586ae03b2 | |
file_path: resume.json | |
file_type: json | |
# TODO: The below step is no longer needed. Need to consider updating the | |
# resume GIST: | |
# https://gist.github.com/mrreyes512/91db4ee7d322c69ed3131fd586ae03b2 | |
# Deploy-To-GHPage: | |
# # Make a commit to the gh-page branch | |
# name: Updating Index.html π | |
# needs: [Convert-Resume-HTML, Convert-Resume-PDF] | |
# runs-on: ubuntu-20.04 | |
# steps: | |
# - name: Check out repository code | |
# uses: actions/checkout@v2 | |
# with: | |
# ref: gh-page | |
# - name: Download the resume HTML artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: resume.html | |
# - name: Download the resume PDF artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: resume.pdf | |
# - name: Get current date | |
# id: date | |
# run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
# - run: mkdir -p docs && mv resume.html docs/index.html | |
# - run: mv resume.pdf docs/resume_${{ steps.date.outputs.date }}.pdf | |
# - name: Publish GH Page | |
# uses: EndBug/add-and-commit@v7 | |
# with: | |
# add: docs/ | |
# branch: gh-page | |
# message: Auto Update index.html | |
# author_name: Mark Reyes | |
# committer_name: GitHub Actions | |
# committer_email: [email protected] |