From 4f1e318611cd6e10a40dbbf1cfe3496628ab57c0 Mon Sep 17 00:00:00 2001 From: Genji Date: Wed, 15 Nov 2023 14:24:25 +0900 Subject: [PATCH] Create github-pages.yml --- .github/workflows/github-pages.yml | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/github-pages.yml diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 0000000..dcf9020 --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -0,0 +1,37 @@ +name: Build and Deploy +on: [push] +jobs: + build-and-deploy: + runs-on: ubuntu-latest + if: ${{ contains(github.event.head_commit.message, 'Upload') }} + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2.3.1 + + - name: Set env + run: | + echo "slide=$(echo '${{ github.event.head_commit.message }}' | cut -d' ' -f 2)" >> $GITHUB_ENV + + - name: Install and Build 🔧 + run: | + echo ${{ env.slide }} + npm install + npm run build -- ${{ env.slide }}.md --base /${{ env.slide }}/ + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@4.1.4 + with: + branch: gh-pages # The branch the action should deploy to. + folder: dist # The folder the action should deploy. + target-folder: ${{ env.slide }} + clean: false + + - name: Checkout for README 🛎️ + uses: actions/checkout@v2.3.1 + - name: Update README + run: | + echo "| [${{ env.slide }}](${{ env.slide }}.md) | |" >> README.md + - name: Commit README changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "readme: add ${{ env.slide }} link" + file_pattern: README.md \ No newline at end of file