diff --git a/.github/workflows/content_list_page.yml b/.github/workflows/content_list_page.yml new file mode 100644 index 0000000..14281c1 --- /dev/null +++ b/.github/workflows/content_list_page.yml @@ -0,0 +1,86 @@ +name: Update GitHub Pages + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + update-content: + runs-on: ubuntu-latest + + steps: + - name: Configure Git user + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + + # Step 1: Checkout the 'github_pages_from_main' branch + - name: Checkout github_pages_from_main branch + uses: actions/checkout@v4 + with: + ref: github_pages_from_main + + - name: Configure Git Pull Strategy + run: git config pull.rebase false # Use 'true' for rebase or 'ff only' for fast-forward only + + # Step 2: Merge changes from 'main' into 'github_pages_from_main' + - name: Merge main into github_pages_from_main + run: | + git remote set-url origin https://x-access-token:${{ secrets.TOKEN }}@github.com/${{ github.repository }}.git + git checkout github_pages_from_main + git pull origin main --allow-unrelated-histories -X theirs + + # Step 3: Ensure files.json exists + - name: Create files.json if it does not exist + run: | + if [ ! -f files.json ]; then + echo "[]" > files.json + fi + + # Step 4: Run the JavaScript script to update the files.json + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Install dependencies + run: npm install node-fetch + + - name: Run update script + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} + run: node updateContentGitHubActionsGitHubPages.mjs + + # Step 5: Commit and push changes to github_pages_from_main + - name: Commit and push changes to github_pages_from_main + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add files.json + git commit -m 'Update files.json with latest Kotlin files' || echo "No changes to commit" + git push https://x-access-token:${{ secrets.TOKEN }}@github.com/${{ github.repository }}.git HEAD:github_pages_from_main + + deploy: + needs: update-content + runs-on: ubuntu-latest + + steps: + # Step 6: Deploy the content to GitHub Pages + - name: Checkout github_pages_from_main branch + uses: actions/checkout@v3 + with: + ref: github_pages_from_main + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.TOKEN }} + publish_dir: ./kotlinDSAWithIntellijIdea + destination_branch: gh-pages # Specify the branch to deploy to \ No newline at end of file diff --git a/files.json b/files.json new file mode 100644 index 0000000..2230eb4 --- /dev/null +++ b/files.json @@ -0,0 +1,142 @@ +[ + { + "name": "array.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level02DataTypes/array.kt" + }, + { + "name": "scanner.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level06/scanner.kt" + }, + { + "name": "maxPairProduct.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level10/maxPairProduct.kt" + }, + { + "name": "010nthFibonacci.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/010nthFibonacci.kt" + }, + { + "name": "012nthFibonacciModulo.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/012nthFibonacciModulo.kt" + }, + { + "name": "013nthFibonacciModuloArithmetically.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/013nthFibonacciModuloArithmetically.kt" + }, + { + "name": "015lastDigitOfNthFibonacci.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/015lastDigitOfNthFibonacci.kt" + }, + { + "name": "020hugeNthFibonacciModuloDynamic.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/020hugeNthFibonacciModuloDynamic.kt" + }, + { + "name": "028naiveLastDigit4SumOfNthFibonacci.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/028naiveLastDigit4SumOfNthFibonacci.kt" + }, + { + "name": "030lastDigit4sumOfNthFibonacci.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/030lastDigit4sumOfNthFibonacci.kt" + }, + { + "name": "035lastDigitOfPartialSumOfNthFibonacci.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/035lastDigitOfPartialSumOfNthFibonacci.kt" + }, + { + "name": "036lastDigitOfPartialSumOfNthFibonacci.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/036lastDigitOfPartialSumOfNthFibonacci.kt" + }, + { + "name": "040lastDigitOfSumOfSquareOfNthFibonacci.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/040lastDigitOfSumOfSquareOfNthFibonacci.kt" + }, + { + "name": "05naivePrintFibonacciUpTo.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/05naivePrintFibonacciUpTo.kt" + }, + { + "name": "070gcdOrHcfUsingEuclid.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/070gcdOrHcfUsingEuclid.kt" + }, + { + "name": "071gcdOrHcfUsingEuclid.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/071gcdOrHcfUsingEuclid.kt" + }, + { + "name": "080lcmUsingEuclideanTheory.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/080lcmUsingEuclideanTheory.kt" + }, + { + "name": "090Josephus.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/090Josephus.kt" + }, + { + "name": "091josephusProblem.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/091josephusProblem.kt" + }, + { + "name": "100RangeSumQueryImmutable.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level20Week2AlgorithmicWarmUp/100RangeSumQueryImmutable.kt" + }, + { + "name": "010MoneyChangeDenomination.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level30Module3AlgorithmExercise/010MoneyChangeDenomination.kt" + }, + { + "name": "020maximumLoot.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level30Module3AlgorithmExercise/020maximumLoot.kt" + }, + { + "name": "030carFueling.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level30Module3AlgorithmExercise/030carFueling.kt" + }, + { + "name": "032carFueling2ndWay.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level30Module3AlgorithmExercise/032carFueling2ndWay.kt" + }, + { + "name": "040maximumDotProductOf2Sequences.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level30Module3AlgorithmExercise/040maximumDotProductOf2Sequences.kt" + }, + { + "name": "050minimumPointsToCoverUnionSegments.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level30Module3AlgorithmExercise/050minimumPointsToCoverUnionSegments.kt" + }, + { + "name": "060distinctSummandsProblem.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level30Module3AlgorithmExercise/060distinctSummandsProblem.kt" + }, + { + "name": "070largestConcatenatedNumber.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level30Module3AlgorithmExercise/070largestConcatenatedNumber.kt" + }, + { + "name": "010selectionSortExample.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level40Module4AlgorithmExercise/010selectionSortExample.kt" + }, + { + "name": "020mergeSortExample.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level40Module4AlgorithmExercise/020mergeSortExample.kt" + }, + { + "name": "030mergeSortClean.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level40Module4AlgorithmExercise/030mergeSortClean.kt" + }, + { + "name": "040countSortExample.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level40Module4AlgorithmExercise/040countSortExample.kt" + }, + { + "name": "050countSortClean.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level40Module4AlgorithmExercise/050countSortClean.kt" + }, + { + "name": "060quickSort1.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level40Module4AlgorithmExercise/060quickSort1.kt" + }, + { + "name": "070quickSort1Clean.kt", + "url": "https://github.com/sagarpatel288/kotlinDSAWithIntellijIdea/blob/main/src/level40Module4AlgorithmExercise/070quickSort1Clean.kt" + } +] \ No newline at end of file diff --git a/fonts/Roboto.woff2 b/fonts/Roboto.woff2 new file mode 100644 index 0000000..07f2ea6 Binary files /dev/null and b/fonts/Roboto.woff2 differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..dd7d667 --- /dev/null +++ b/index.html @@ -0,0 +1,141 @@ + + +
+ + +