|
From: vampire0 <vam...@us...> - 2025-03-17 03:26:08
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "jEdit jEdit plugin".
The branch, master has been updated
via 144ce3b2cf65e7dd4392ec672d95e81dbec66d93 (commit)
from c0d8b66178be96b51d6eb8032a9c48fd9cf0b660 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit: https://sourceforge.net/p/jedit/jEdit/ci/144ce3b2cf65e7dd4392ec672d95e81dbec66d93/
tree: https://sourceforge.net/p/jedit/jEdit/ci/144ce3b2cf65e7dd4392ec672d95e81dbec66d93/tree/
commit 144ce3b2cf65e7dd4392ec672d95e81dbec66d93
Author: Björn Kautler <Bj...@Ka...>
Date: Mon Mar 17 04:12:11 2025 +0100
Add repository mirroring GitHub workflow
diff --git a/.github/workflows/README.adoc b/.github/workflows/README.adoc
new file mode 100644
index 000000000..4fed2413a
--- /dev/null
+++ b/.github/workflows/README.adoc
@@ -0,0 +1,41 @@
+== The YAML workflow files vs. the `*.main.kts` files
+
+The YAML workflow files are generated from the `*.main.kts` files.
+
+These use the https://github.com/typesafegithub/github-workflows-kt[github-workflows-kt]
+Kotlin DSL library to conveniently and type-safely write GitHub Action workflow files.
+
+As there is no official built-in support in GitHub Actions yet until
+https://github.com/orgs/community/discussions/15904 is considered, the YAML files
+need to be generated manually.
+
+There is a safeguard check in all the generated files that this is not forgotten.
+Running a workflow where the according `*.main.kts` produces a different output will
+fail the execution. Additionally, a workflow that runs for pushes and pull requests
+checks the consistency of all the YAML files as not all might be run.
+
+
+
+== Ways to generate the YAML workflow files
+
+There are multiple ways to generate the YAML files and all of them are fine,
+but be aware of the last one of the caveats below if you are not using the Gradle method:
+
+* If you are in a `sh` derivate like e.g. `bash` and Kotlin is installed and
+ available in the `PATH`, you can just call the `*.main.kts` script like any
+ other shell script:
++
+[source,bash]
+----
+$ ./release.main.kts
+----
+
+* If Kotlin is installed somewhere you can call it with the `*.main.kts` script
+ as argument:
++
+[source,bash]
+----
+$ path/to/kotlin release.main.kts
+----
+
+* From the IDE you can create a run configuration that executes the `*.main.kts` script.
diff --git a/.github/workflows/check-all-workflow-yaml-consistency.main.kts b/.github/workflows/check-all-workflow-yaml-consistency.main.kts
new file mode 100644
index 000000000..be74efc3e
--- /dev/null
+++ b/.github/workflows/check-all-workflow-yaml-consistency.main.kts
@@ -0,0 +1,46 @@
+#!/usr/bin/env kotlin
+
+@file:Repository("https://repo.maven.apache.org/maven2/")
+@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.2.0")
+
+@file:Repository("https://bindings.krzeminski.it/")
+@file:DependsOn("actions:checkout___major:[v4,v5-alpha)")
+
+import io.github.typesafegithub.workflows.actions.actions.Checkout
+import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
+import io.github.typesafegithub.workflows.domain.triggers.PullRequest
+import io.github.typesafegithub.workflows.domain.triggers.Push
+import io.github.typesafegithub.workflows.dsl.workflow
+
+workflow(
+ name = "Check all Workflow YAML Consistency",
+ on = listOf(
+ Push(),
+ PullRequest()
+ ),
+ sourceFile = __FILE__
+) {
+ job(
+ id = "check_all_workflow_yaml_consistency",
+ name = "Check all Workflow YAML Consistency",
+ runsOn = UbuntuLatest
+ ) {
+ uses(
+ name = "Checkout",
+ action = Checkout()
+ )
+
+ run(
+ name = "Regenerate all Workflow YAMLs",
+ command = """find .github/workflows -mindepth 1 -maxdepth 1 -name '*.main.kts' -exec {} \;"""
+ )
+
+ run(
+ name = "Check for Modifications",
+ command = """
+ git add --intent-to-add .
+ git diff --exit-code
+ """.trimIndent()
+ )
+ }
+}
diff --git a/.github/workflows/check-all-workflow-yaml-consistency.yaml b/.github/workflows/check-all-workflow-yaml-consistency.yaml
new file mode 100644
index 000000000..674cca9bf
--- /dev/null
+++ b/.github/workflows/check-all-workflow-yaml-consistency.yaml
@@ -0,0 +1,39 @@
+# This file was generated using Kotlin DSL (.github/workflows/check-all-workflow-yaml-consistency.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: 'Check all Workflow YAML Consistency'
+on:
+ push: {}
+ pull_request: {}
+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/check-all-workflow-yaml-consistency.yaml'' && ''.github/workflows/check-all-workflow-yaml-consistency.main.kts'''
+ - id: 'step-2'
+ name: 'Consistency check'
+ run: 'git diff --exit-code ''.github/workflows/check-all-workflow-yaml-consistency.yaml'''
+ check_all_workflow_yaml_consistency:
+ name: 'Check all Workflow YAML Consistency'
+ runs-on: 'ubuntu-latest'
+ needs:
+ - 'check_yaml_consistency'
+ steps:
+ - id: 'step-0'
+ name: 'Checkout'
+ uses: 'actions/checkout@v4'
+ - id: 'step-1'
+ name: 'Regenerate all Workflow YAMLs'
+ run: 'find .github/workflows -mindepth 1 -maxdepth 1 -name ''*.main.kts'' -exec {} \;'
+ - id: 'step-2'
+ name: 'Check for Modifications'
+ run: |-
+ git add --intent-to-add .
+ git diff --exit-code
diff --git a/.github/workflows/mirror-canonical-repository.main.kts b/.github/workflows/mirror-canonical-repository.main.kts
new file mode 100644
index 000000000..ad4877eef
--- /dev/null
+++ b/.github/workflows/mirror-canonical-repository.main.kts
@@ -0,0 +1,41 @@
+#!/usr/bin/env kotlin
+
+@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.2.0")
+
+import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
+import io.github.typesafegithub.workflows.domain.triggers.Cron
+import io.github.typesafegithub.workflows.domain.triggers.Push
+import io.github.typesafegithub.workflows.domain.triggers.RepositoryDispatch
+import io.github.typesafegithub.workflows.domain.triggers.Schedule
+import io.github.typesafegithub.workflows.domain.triggers.WorkflowDispatch
+import io.github.typesafegithub.workflows.dsl.expressions.Contexts.secrets
+import io.github.typesafegithub.workflows.dsl.expressions.expr
+import io.github.typesafegithub.workflows.dsl.workflow
+
+workflow(
+ name = "Mirror Canonical Repository",
+ on = listOf(
+ Push(),
+ RepositoryDispatch(),
+ Schedule(triggers = listOf(Cron(minute = "44"))),
+ WorkflowDispatch()
+ ),
+ sourceFile = __FILE__
+) {
+ job(
+ id = "mirror_repository",
+ name = "Mirror Repository",
+ runsOn = UbuntuLatest
+ ) {
+ run(
+ name = "Clone Canonical Repository",
+ command = "git clone --bare git://git.code.sf.net/p/jedit/\${GITHUB_REPOSITORY#\$GITHUB_REPOSITORY_OWNER/} ."
+ )
+
+ val MIRROR_TOKEN by secrets
+ run(
+ name = "Push To Mirror Repository",
+ command = "git push --mirror https://x:${expr(MIRROR_TOKEN)}@github.com/${expr { github.repository }}"
+ )
+ }
+}
diff --git a/.github/workflows/mirror-canonical-repository.yaml b/.github/workflows/mirror-canonical-repository.yaml
new file mode 100644
index 000000000..c2ce9a641
--- /dev/null
+++ b/.github/workflows/mirror-canonical-repository.yaml
@@ -0,0 +1,37 @@
+# This file was generated using Kotlin DSL (.github/workflows/mirror-canonical-repository.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: 'Mirror Canonical Repository'
+on:
+ push: {}
+ repository_dispatch: {}
+ schedule:
+ - cron: '44 * * * *'
+ workflow_dispatch: {}
+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/mirror-canonical-repository.yaml'' && ''.github/workflows/mirror-canonical-repository.main.kts'''
+ - id: 'step-2'
+ name: 'Consistency check'
+ run: 'git diff --exit-code ''.github/workflows/mirror-canonical-repository.yaml'''
+ mirror_repository:
+ name: 'Mirror Repository'
+ runs-on: 'ubuntu-latest'
+ needs:
+ - 'check_yaml_consistency'
+ steps:
+ - id: 'step-0'
+ name: 'Clone Canonical Repository'
+ run: 'git clone --bare git://git.code.sf.net/p/jedit/${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/} .'
+ - id: 'step-1'
+ name: 'Push To Mirror Repository'
+ run: 'git push --mirror https://x:${{ secrets.MIRROR_TOKEN }}@github.com/${{ github.repository }}'
-----------------------------------------------------------------------
Summary of changes:
.github/workflows/README.adoc | 41 +++++++++++++++++++
.../check-all-workflow-yaml-consistency.main.kts | 46 ++++++++++++++++++++++
.../check-all-workflow-yaml-consistency.yaml | 39 ++++++++++++++++++
.../workflows/mirror-canonical-repository.main.kts | 41 +++++++++++++++++++
.github/workflows/mirror-canonical-repository.yaml | 37 +++++++++++++++++
5 files changed, 204 insertions(+)
create mode 100644 .github/workflows/README.adoc
create mode 100644 .github/workflows/check-all-workflow-yaml-consistency.main.kts
create mode 100644 .github/workflows/check-all-workflow-yaml-consistency.yaml
create mode 100644 .github/workflows/mirror-canonical-repository.main.kts
create mode 100644 .github/workflows/mirror-canonical-repository.yaml
hooks/post-receive
--
jEdit jEdit plugin
|