Skip to content

Commit

Permalink
Add a workflow for deploying the app
Browse files Browse the repository at this point in the history
  • Loading branch information
krzema12 committed May 11, 2024
1 parent 1c0c28c commit 376847e
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/deploy.main.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env kotlin
@file:Repository("https://repo1.maven.org/maven2/")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.15.0")

@file:Repository("https://github-workflows-kt-bindings.colman.com.br/binding/")
@file:DependsOn("actions:checkout:v4")
@file:DependsOn("gradle:actions__setup-gradle:v3")
@file:DependsOn("actions:configure-pages:v5")
@file:DependsOn("actions:upload-pages-artifact:v3")
@file:DependsOn("actions:deploy-pages:v4")

import io.github.typesafegithub.workflows.actions.actions.Checkout
import io.github.typesafegithub.workflows.actions.actions.ConfigurePages
import io.github.typesafegithub.workflows.actions.actions.DeployPages
import io.github.typesafegithub.workflows.actions.actions.UploadPagesArtifact
import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
import io.github.typesafegithub.workflows.domain.RunnerType
import io.github.typesafegithub.workflows.domain.triggers.Push
import io.github.typesafegithub.workflows.dsl.workflow
import io.github.typesafegithub.workflows.yaml.writeToFile

workflow(
name = "Deploy",
on = listOf(Push(branches = listOf("main"))),
sourceFile = __FILE__.toPath(),
) {
job(id = "deploy", runsOn = RunnerType.UbuntuLatest) {
uses(action = Checkout())
uses(action = ActionsSetupGradle())
run(command = "./gradlew wasmJsBrowserDistribution")
uses(action = ConfigurePages())
uses(action = UploadPagesArtifact(path = "build/dist/wasmJs/productionExecutable"))
uses(action = DeployPages())
}
}.writeToFile()
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file was generated using Kotlin DSL (.github/workflows/deploy.main.kts).
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
# Generated with https://github.com/typesafegithub/github-workflows-kt

name: 'Deploy'
on:
push:
branches:
- 'main'
jobs:
check_yaml_consistency:
name: 'Check YAML consistency'
runs-on: 'ubuntu-latest'
steps:
- id: 'step-0'
name: 'Check out'
uses: 'actions/checkout@v4'
- id: 'step-1'
name: 'Execute script'
run: 'rm ''.github/workflows/deploy.yaml'' && ''.github/workflows/deploy.main.kts'''
- id: 'step-2'
name: 'Consistency check'
run: 'git diff --exit-code ''.github/workflows/deploy.yaml'''
deploy:
runs-on: 'ubuntu-latest'
needs:
- 'check_yaml_consistency'
steps:
- id: 'step-0'
uses: 'actions/checkout@v4'
- id: 'step-1'
uses: 'gradle/actions/setup-gradle@v3'
- id: 'step-2'
run: './gradlew wasmJsBrowserDistribution'
- id: 'step-3'
uses: 'actions/configure-pages@v5'
- id: 'step-4'
uses: 'actions/upload-pages-artifact@v3'
with:
path: 'build/dist/wasmJs/productionExecutable'
- id: 'step-5'
uses: 'actions/deploy-pages@v4'

0 comments on commit 376847e

Please sign in to comment.