Replace bin/deploy with GitHub Action (#1234)

This PR updates `deploy.yml` to use the GitHub Action [Deploy to GitHub Pages](https://github.com/marketplace/actions/deploy-to-github-pages).
This commit is contained in:
Scott Lee Chua 2023-03-19 18:41:02 +08:00 committed by Maruan Al-Shedivat
parent 56480a713a
commit 2f49d07dc3
4 changed files with 17 additions and 26 deletions

View File

@ -13,7 +13,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Buildx - name: Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1

View File

@ -13,7 +13,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Buildx - name: Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1

View File

@ -9,34 +9,29 @@ on:
branches: branches:
- master - master
- main - main
workflow_dispatch:
permissions:
contents: write
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout 🛎️
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Ruby - name: Setup Ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: '3.0.2' ruby-version: '3.2.1'
bundler-cache: true bundler-cache: true
- name: Install deps - name: Install and Build 🔧
run: | run: |
npm install -g mermaid.cli npm install -g mermaid.cli
- name: Setup deploy options bundle exec jekyll build
id: setup - name: Deploy 🚀
run: | if: github.event_name != 'pull_request'
git config --global user.name "GitHub Action" uses: JamesIves/github-pages-deploy-action@v4
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" with:
if [[ ${GITHUB_REF} = refs/pull/*/merge ]]; then # pull request folder: _site
echo "SRC_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_OUTPUT
echo "NO_PUSH=--no-push" >> $GITHUB_OUTPUT
elif [[ ${GITHUB_REF} = refs/heads/* ]]; then # branch, e.g. master, source etc
echo "SRC_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
fi
echo "DEPLOY_BRANCH=gh-pages" >> $GITHUB_OUTPUT
- name: Deploy website
run: yes | bash bin/deploy --verbose ${{ steps.setup.outputs.NO_PUSH }}
--src ${{ steps.setup.outputs.SRC_BRANCH }}
--deploy ${{ steps.setup.outputs.DEPLOY_BRANCH }}

View File

@ -259,11 +259,7 @@ Starting version [v0.3.5](https://github.com/alshedivat/al-folio/releases/tag/v0
<details><summary>(click to expand) <strong>Manual deployment to GitHub Pages:</strong></summary> <details><summary>(click to expand) <strong>Manual deployment to GitHub Pages:</strong></summary>
If you need to manually re-deploy your website to GitHub pages, run the deploy script from the root directory of your repository: If you need to manually re-deploy your website to GitHub pages, go to Actions, click "Deploy" in the left sidebar, then "Run workflow."
```bash
$ ./bin/deploy
```
uses the `master` branch for the source code and deploys the webpage to `gh-pages`.
</details> </details>