Add deploy config

This commit is contained in:
Mikołaj Pich 2021-09-25 16:05:24 +02:00
parent d239094dbe
commit cbe6a36ee8
7 changed files with 52 additions and 14 deletions

32
.github/workflows/deploy.yml vendored Normal file
View file

@ -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

1
.gitignore vendored
View file

@ -72,3 +72,4 @@ gradle-app.setting
classes
.DS_Store
.idea/libraries-with-intellij-classes.xml
dist/messages.json

View file

@ -1 +1,3 @@
# messages
# Wulkanowy Messages
Go to https://wulkanowy.github.io/messages/

View file

@ -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()
}
}
}

11
dist/index.html vendored Normal file
View file

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Wulkanowy Messages</title>
</head>
<body>
<a href="messages.json">Open messages.json</a>
</body>
</html>

View file

@ -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"

View file

@ -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)
}