commit b1e281cbdee81d57616f922a2c21e4af62c68cca Author: Matej Focko Date: Sun Dec 1 13:01:15 2024 +0100 Initial commit diff --git a/.github/readme/cover.png b/.github/readme/cover.png new file mode 100644 index 0000000..bb6ca6f Binary files /dev/null and b/.github/readme/cover.png differ diff --git a/.github/readme/livestream.png b/.github/readme/livestream.png new file mode 100644 index 0000000..7371300 Binary files /dev/null and b/.github/readme/livestream.png differ diff --git a/.github/readme/run.png b/.github/readme/run.png new file mode 100644 index 0000000..f006d95 Binary files /dev/null and b/.github/readme/run.png differ diff --git a/.github/template-cleanup/README.md b/.github/template-cleanup/README.md new file mode 100644 index 0000000..ab56107 --- /dev/null +++ b/.github/template-cleanup/README.md @@ -0,0 +1,25 @@ +# %NAME% + +Welcome to the Advent of Code[^aoc] Kotlin project created by [%ACTOR%][github] using the [Advent of Code Kotlin Template][template] delivered by JetBrains. + +In this repository, %ACTOR% is about to provide solutions for the puzzles using [Kotlin][kotlin] language. + +If you're stuck with Kotlin-specific questions or anything related to this template, check out the following resources: + +- [Kotlin docs][docs] +- [Kotlin Slack][slack] +- Template [issue tracker][issues] + + +[^aoc]: + [Advent of Code][aoc] – An annual event of Christmas-oriented programming challenges started December 2015. + Every year since then, beginning on the first day of December, a programming puzzle is published every day for twenty-five days. + You can solve the puzzle and provide an answer using the language of your choice. + +[aoc]: https://adventofcode.com +[docs]: https://kotlinlang.org/docs/home.html +[github]: https://github.com/%ACTOR% +[issues]: https://github.com/kotlin-hands-on/advent-of-code-kotlin-template/issues +[kotlin]: https://kotlinlang.org +[slack]: https://surveys.jetbrains.com/s3/kotlin-slack-sign-up +[template]: https://github.com/kotlin-hands-on/advent-of-code-kotlin-template diff --git a/.github/template-cleanup/settings.gradle.kts b/.github/template-cleanup/settings.gradle.kts new file mode 100644 index 0000000..872205f --- /dev/null +++ b/.github/template-cleanup/settings.gradle.kts @@ -0,0 +1,7 @@ +rootProject.name = "%NAME%" + +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} diff --git a/.github/workflows/template-cleanup.yml b/.github/workflows/template-cleanup.yml new file mode 100644 index 0000000..29d78f1 --- /dev/null +++ b/.github/workflows/template-cleanup.yml @@ -0,0 +1,70 @@ +# GitHub Actions Workflow responsible for cleaning up the Advent of Code Kotlin Template repository from +# the template-specific files and configurations. This workflow is supposed to be triggered automatically +# when a new template-based repository has been created. + +name: Template Cleanup +on: + push: + branches: [main] + +jobs: + + # Run cleaning process only if workflow is triggered by the non-"advent-of-code-kotlin-template" repository. + template-cleanup: + name: Template Cleanup + runs-on: ubuntu-latest + if: github.event.repository.name != 'advent-of-code-kotlin-template' + permissions: + contents: write + steps: + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Cleanup project + - name: Cleanup + run: | + export LC_CTYPE=C + export LANG=C + + # Prepare variables + NAME="${GITHUB_REPOSITORY##*/}" + ACTOR=$(echo $GITHUB_ACTOR | tr '[:upper:]' '[:lower:]') + SAFE_NAME=$(echo $NAME | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]') + SAFE_ACTOR=$(echo $ACTOR | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]') + GROUP="com.github.$SAFE_ACTOR.$SAFE_NAME" + + # Replace placeholders in the template-cleanup files + sed -i "s/%ACTOR%/$ACTOR/g" .github/template-cleanup/* + sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/* + sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" .github/template-cleanup/* + sed -i "s/%GROUP%/$GROUP/g" .github/template-cleanup/* + + # Move content + cp -R .github/template-cleanup/* . + + # Cleanup + rm -rf \ + .github/readme \ + .github/template-cleanup \ + .github/workflows/template-cleanup.yml \ + LICENSE + + # Remove leftover empty directories + find . -type d -empty -delete + + # Commit modified files + - name: Commit files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git commit -m "Template cleanup" + + # Push changes + - name: Push changes + uses: ad-m/github-push-action@master + with: + branch: main + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2c6aeb --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.gradle +.idea +.kotlin/ +build +src/**/*.txt +local.properties diff --git a/.idea/file.template.settings.xml b/.idea/file.template.settings.xml new file mode 100644 index 0000000..5e3f789 --- /dev/null +++ b/.idea/file.template.settings.xml @@ -0,0 +1,11 @@ + + + + +