From 472784ce0d5ea74f0dbbc275a0a7552d500b55ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB=E7=8C=AB?= Date: Tue, 5 Dec 2023 15:51:23 +0800 Subject: [PATCH] ci: add gh-pages ci (#444) --- .github/workflows/deploy-gh-pages.yml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/deploy-gh-pages.yml diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml new file mode 100644 index 00000000..37cb6a4c --- /dev/null +++ b/.github/workflows/deploy-gh-pages.yml @@ -0,0 +1,49 @@ +name: Deploy to GitHub Pages + +on: + push: + tags: + - "*" + +permissions: + contents: write + +jobs: + deploy: + runs-on: macos-12 + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo gem install jazzy + brew bundle + bundle install + + - name: Set version env var + run: | + echo "CURRENT_VERSION=$(cat .version | xargs)" >> "$GITHUB_ENV" + + - name: Build docs + env: + REPO_URL: "${{ github.server_url }}/${{ github.repository }}" + run: >- + jazzy + --output ./apidocs + --build-tool-arguments + -project,./LeanCloud.xcodeproj,-scheme,LeanCloud,-configuration,Release + --author LeanCloud + --author_url https://leancloud.cn + --module LeanCloud + --module-version $CURRENT_VERSION + --github_url $REPO_URL + --github-file-prefix "${REPO_URL}/tree/${CURRENT_VERSION}" + --root-url "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}" + + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: apidocs + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com"