test github actions

This commit is contained in:
Matthew Wong 2022-12-04 20:02:08 -05:00
parent 5000d80bc8
commit a3b0e07db2
1 changed files with 43 additions and 0 deletions

43
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Publish Markdown Files
env:
BLOG_REPO: matthewwong525/linked-blog-starter
PUBLISH_DIR: . # root directory
MD_DIR: temp_md
BLOG_DIR: temp_blog
on:
push:
branches: [main]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ env.MD_DIR }}
- name: Checkout linked blog starter repo
uses: actions/checkout@v3
with:
path: ${{ env.BLOG_DIR }}
repository: ${{ env.BLOG_REPO }}
- name: Install Rust / cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install and run obsidian-export
run: |
cargo install obsidian-export
rm -rf ${{ env.BLOG_DIR }}/_commonMD && mkdir ${{ env.BLOG_DIR }}/_commonMD
~/.cargo/bin/obsidian-export ./${{ env.MD_DIR }}/${{ env.PUBLISH_DIR }} ${{ env.BLOG_DIR }}/_commonMD
- name: Move blog dir to currDir
run: |
cp -r ${{ env.BLOG_DIR }}/. .
rm -rf ${{ env.BLOG_DIR }}
rm -rf ${{ env.MD_DIR }}
- name: Deploy Vercel
uses: amondnet/vercel-action@v20
with:
# TODO: Update Github Secrets with values
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} # Required
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} # Required