Skip to content

Commit

Permalink
Update worflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-vasilev committed May 1, 2024
1 parent a90e218 commit aff7e3a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
31 changes: 30 additions & 1 deletion .github/actions/publish_pages/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,49 @@ inputs:
base_path:
required: true
type: string
# base_path_prefix:
# required: false
# type: string

runs:
using: "composite"

steps:
# - name: Checkout 🛎️
# uses: actions/checkout@v3
# with:
# fetch-depth: 0

- name: Build DocC
shell: bash
run: |
mkdir ./docs;
swift build;
swift package \
--allow-writing-to-directory ./docs \
generate-documentation \
--target ${{ inputs.target }} \
--output-path ./docs/${{ inputs.base_path }} \
--transform-for-static-hosting \
--hosting-base-path flare/${{ inputs.base_path }};
--hosting-base-path flare/${{ inputs.base_path }};
- name: Commit and push generated documentation
shell: bash
run: |
git fetch
git worktree add --checkout gh-pages origin/gh-pages
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git switch gh-pages
rm -r ./${{ inputs.base_path }}
cp -r ./docs/${{ inputs.base_path }} ./${{ inputs.base_path }}
rm -r ./docs
git add ./${{ inputs.base_path }}
git commit -a -m "Generated ${{ inputs.target }} Swift DocC"
git push origin gh-pages
git worktree remove gh-pages
33 changes: 5 additions & 28 deletions .github/workflows/publish-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,8 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build DocC
shell: bash
run: |
mkdir ./docs;
swift build;
swift package \
--allow-writing-to-directory ./docs \
generate-documentation \
--target ${{ matrix.target }} \
--output-path ./docs/${{ matrix.base_path }} \
--transform-for-static-hosting \
--hosting-base-path flare/${{ matrix.base_path }};
- name: Commit and push generated documentation
run: |
git fetch
git worktree add --checkout gh-pages origin/gh-pages
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git switch gh-pages
rm -r ./${{ matrix.base_path }}
cp -r ./docs/${{ matrix.base_path }} ./${{ matrix.base_path }}
rm -r ./docs
git add ./${{ matrix.base_path }}
git commit -a -m "Generated ${{ matrix.target }} Swift DocC"
git push origin gh-pages
- name: Build and Push Generated Documentation
uses: ./.github/actions/publish_pages
with:
target: ${{ matrix.target }}
base_path: ${{ matrix.base_path }}

0 comments on commit aff7e3a

Please sign in to comment.