diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..48c11c5 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,32 @@ +name: Deploy + +on: + push: + branches: [ master ] + +jobs: + docs: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: fkirc/skip-duplicate-actions@master + - uses: actions/checkout@v2 + - uses: gradle/wrapper-validation-action@v1 + - uses: actions/setup-java@v1 + with: + java-version: 11 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }} + - name: Generate messages + run: ./gradlew run + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: dist/ + CLEAN: true diff --git a/.gitignore b/.gitignore index c45c5ed..5dc3c11 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,4 @@ gradle-app.setting classes .DS_Store .idea/libraries-with-intellij-classes.xml +dist/messages.json diff --git a/README.md b/README.md index 30fc1dc..09c6f56 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# messages \ No newline at end of file +# Wulkanowy Messages + +Go to https://wulkanowy.github.io/messages/ diff --git a/build.gradle b/build.gradle index e176f7b..cad344c 100644 --- a/build.gradle +++ b/build.gradle @@ -18,15 +18,3 @@ allprojects { mavenCentral() } } - -subprojects { - java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - jvmTarget = JavaVersion.VERSION_11.toString() - } - } -} diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..cf467b2 --- /dev/null +++ b/dist/index.html @@ -0,0 +1,11 @@ + + + + + + Wulkanowy Messages + + + Open messages.json + + diff --git a/generator/build.gradle b/generator/build.gradle index fc1943a..8eb08c0 100644 --- a/generator/build.gradle +++ b/generator/build.gradle @@ -1,9 +1,12 @@ plugins { id 'java' + id 'application' id 'org.jetbrains.kotlin.jvm' id 'org.jetbrains.kotlin.plugin.serialization' } +mainClassName = 'MainKt' + dependencies { implementation project(":pojos") implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0" diff --git a/generator/src/main/kotlin/main.kt b/generator/src/main/kotlin/main.kt index bec82ad..4241532 100644 --- a/generator/src/main/kotlin/main.kt +++ b/generator/src/main/kotlin/main.kt @@ -2,6 +2,7 @@ import io.github.wulkanowy.messages.pojo.Message import io.github.wulkanowy.messages.pojo.MessageType import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json +import java.io.File val messages = listOf( Message( @@ -14,5 +15,5 @@ val messages = listOf( fun main() { val json = Json.encodeToString(messages) - println(json) + File("../dist/messages.json").writeText(json) }