Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop wasting time on versioned docs #184

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 8 additions & 47 deletions .github/workflows/versionedDocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,12 @@ concurrency:
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull') }}

jobs:
set-matrix:
runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
matrix-values: ${{ steps.set-matrix.outputs.matrix-values }}

steps:
- uses: actions/checkout@v3
- run: git fetch --tags -f origin

- uses: actions/checkout@v3
with:
ref: docs
path: docs

- id: set-matrix
run: |
matrix_values=''
for ref in $(git tag --list); do
docs_path="docs/docs/olderVersions/$ref"
mkdir -p $docs_path
if [[ $(find $docs_path -type d -empty) ]]; then
matrix_values+="{\"ref\":\"$ref\",\"ref_label\":\"$ref\"},"
fi
done
matrix_values+='{"ref":"main","ref_label":"main"}'
echo "matrix-values=[${matrix_values}]" >> $GITHUB_OUTPUT
echo "matrix={\"include\":[${matrix_values}]}" >> $GITHUB_OUTPUT
docs:
needs: set-matrix
strategy:
matrix: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ matrix.ref }}
ref: "main"
path: main
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -76,10 +44,10 @@ jobs:
cd -
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.ref_label }}
name: "main"
path: Docs.zip
publish:
needs: [set-matrix, docs]
needs: [docs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -99,18 +67,11 @@ jobs:
- name: Unzip
run: |
mkdir unzipped-docs
for ref in $(echo ${{ toJSON(needs.set-matrix.outputs.matrix-values) }} | jq -r '.[].ref_label'); do
unzipped_path="unzipped-docs/$ref"
mkdir -p "$unzipped_path"
unzip "artifacts/$ref/Docs.zip" -d "$unzipped_path"
if [ "$ref" = "main" ]; then
echo "extracting to root"
rsync -a "$unzipped_path/" docs/docs
else
echo "extracting to olderVersions"
rsync -a "$unzipped_path" docs/docs/olderVersions/
fi
done
unzipped_path="unzipped-docs/main"
mkdir -p "$unzipped_path"
unzip "artifacts/main/Docs.zip" -d "$unzipped_path"
echo "extracting to root"
rsync -a "$unzipped_path/" docs/docs
- name: Update git config
working-directory: docs
run: |
Expand Down
Loading