Skip to content

Commit

Permalink
update pull-request.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hars-21 committed Jan 22, 2025
1 parent b180fa7 commit 0f74a58
Showing 1 changed file with 65 additions and 64 deletions.
129 changes: 65 additions & 64 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,70 +94,6 @@ jobs:
echo "Error: Close this PR and try again."
exit 1
generate-docs:
if: github.ref == 'refs/heads/develop-postgres'
name: Update Documentation
runs-on: ubuntu-latest
environment: TALAWA_ENVIRONMENT
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: "zulu" # See 'Supported distributions' for available options
java-version: "12.0"
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
channel: "stable"
- uses: dart-lang/setup-dart@v1
with:
sdk: "3.4.4"
- run: |
cd talawa_lint && flutter pub get && cd ..
flutter pub get
flutter analyze
dart analyze
flutter pub global activate dartdoc
flutter pub global run dartdoc . --output talawa-mobile-docs --format md --exclude=test/widget_tests/widgets/pinned_carousel_widget_test.dart, lib/widgets/pinned_carousel_widget.dart, lib/widgets/post_widget.dart, test/widget_tests/widgets/post_widget_test.dart
rm -rf talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/build.md
rm -rf talawa-mobile-docs/widgets_post_widget/PostContainerState/build.md
- uses: actions/upload-artifact@v1
with:
name: docs
path: docs/docs/auto-docs
- name: Checking doc updated
id: DocUpdated
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "updateDoc=true" >> $GITHUB_OUTPUT
echo -e "Documentation has been updated!!"
else
Green='0;32'
NoColor='\033[0m'
echo -e "${Green}No documentation updated${NoColor}"
fi
- name: Set env variables
if: steps.DocUpdated.outputs.updateDoc
run: |
echo "commit_id=$(echo $(git rev-parse HEAD))" >> $GITHUB_ENV
echo "email=$(echo $(git log --pretty=format:"%ae" $commit_id))" >> $GITHUB_ENV
- name: Handle untracked files
if: steps.DocUpdated.outputs.updateDoc
run: |
git config --global user.name "${{github.actor}}"
git config --global user.email "${{env.email}}"
git add .
- name: Update Doc
if: steps.DocUpdated.outputs.updateDoc
run: |
Green='0;32'
NoColor='\033[0m'
git config --global user.name "${{github.actor}}"
git config --global user.email "${{env.email}}"
git commit -a -m "Updated docs"
git push
echo -e "🚀${Green} Hurrah! doc updated${NoColor}"
Branch-check:
if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }}
name: "Base branch check"
Expand Down Expand Up @@ -300,6 +236,71 @@ jobs:
- name: Building for ios
run: flutter build ios --release --no-codesign

generate-docs:
if: github.ref == 'refs/heads/develop-postgres'
needs: [Flutter-Codebase-Check]
name: generate docs
runs-on: ubuntu-latest
environment: TALAWA_ENVIRONMENT
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: "zulu" # See 'Supported distributions' for available options
java-version: "12.0"
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
channel: "stable"
- uses: dart-lang/setup-dart@v1
with:
sdk: "3.4.4"
- run: |
cd talawa_lint && flutter pub get && cd ..
flutter pub get
flutter analyze
dart analyze
flutter pub global activate dartdoc
flutter pub global run dartdoc . --output talawa-mobile-docs --format md --exclude=test/widget_tests/widgets/pinned_carousel_widget_test.dart, lib/widgets/pinned_carousel_widget.dart, lib/widgets/post_widget.dart, test/widget_tests/widgets/post_widget_test.dart
rm -rf talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/build.md
rm -rf talawa-mobile-docs/widgets_post_widget/PostContainerState/build.md
- uses: actions/upload-artifact@v1
with:
name: docs
path: docs/docs/auto-docs
- name: Checking doc updated
id: DocUpdated
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "updateDoc=true" >> $GITHUB_OUTPUT
echo -e "Documentation has been updated!!"
else
Green='0;32'
NoColor='\033[0m'
echo -e "${Green}No documentation updated${NoColor}"
fi
- name: Set env variables
if: steps.DocUpdated.outputs.updateDoc
run: |
echo "commit_id=$(echo $(git rev-parse HEAD))" >> $GITHUB_ENV
echo "email=$(echo $(git log --pretty=format:"%ae" $commit_id))" >> $GITHUB_ENV
- name: Handle untracked files
if: steps.DocUpdated.outputs.updateDoc
run: |
git config --global user.name "${{github.actor}}"
git config --global user.email "${{env.email}}"
git add .
- name: Update Doc
if: steps.DocUpdated.outputs.updateDoc
run: |
Green='0;32'
NoColor='\033[0m'
git config --global user.name "${{github.actor}}"
git config --global user.email "${{env.email}}"
git commit -a -m "Updated docs"
git push
echo -e "🚀${Green} Hurrah! doc updated${NoColor}"
Test-Docusaurus-Deployment:
name: Test Deployment to https://docs-mobile.talawa.io
runs-on: ubuntu-latest
Expand Down

0 comments on commit 0f74a58

Please sign in to comment.