Skip to content

Commit

Permalink
Restore automated wiki updates (#1282)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Mar 19, 2023
1 parent 785cf8c commit 71ce943
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 22 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/wiki.yml
@@ -0,0 +1,41 @@
name: Push to the GitHub Wiki

on:
push:
branches:
- master
paths:
- "docs/**"
workflow_dispatch:

permissions:
contents: write

jobs:
push-to-wiki:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
path: job-dsl-plugin
- name: Checkout wiki
uses: actions/checkout@v3
with:
repository: ${{github.repository}}.wiki
path: job-dsl-plugin.wiki
- name: Push to wiki
run: |
git config --global user.email "actions@users.noreply.github.com"
git config --global user.name "wiki[bot]"
pushd job-dsl-plugin
./build-wiki.sh
popd
pushd job-dsl-plugin.wiki
cp -r ../job-dsl-plugin/target/docs/* .
git add .
git commit -m "Automagic update"
git push
popd
1 change: 1 addition & 0 deletions RELEASING.md
Expand Up @@ -5,6 +5,7 @@ These are the steps to release the Maven-based Job DSL plugin.
* Set `compatibleSinceVersion` to the new version if deprecated features have been removed
* Prepare and perform the release: `mvn release:prepare release:perform`
* Edit the [draft release notes](https://github.com/jenkinsci/job-dsl-plugin/releases) and publish them
* Run the [Push to the GitHub Wiki](https://github.com/jenkinsci/job-dsl-plugin/actions/workflows/wiki.yml) workflow to update the wiki with the new version
* File a pull request to add the newly-released version to the API viewer in `job-dsl-plugin/pom.xml` and `job-dsl-plugin/src/main/hbs/root.hbs`
* Close all resolved issues in [JIRA](https://issues.jenkins-ci.org/secure/Dashboard.jspa?selectPageId=15341)
* Open a pull request to update the [Job DSL Playground](https://github.com/sheehan/job-dsl-playground)
Expand Down
15 changes: 15 additions & 0 deletions build-wiki.sh
@@ -0,0 +1,15 @@
#!/bin/sh -eux

mkdir -p target/docs

mvn -B -e -ntp -q -Dexpression=jenkins.version -Doutput=jenkins.version help:evaluate
JENKINS_VERSION=`cat jenkins.version`

curl -sSO https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/job-dsl/maven-metadata.xml
VERSION=$(grep '<latest>.*</latest>' maven-metadata.xml | cut -d'>' -f2 | cut -d'<' -f1)

cp -r docs target
sed -i -e "s/@jenkinsVersion@/${JENKINS_VERSION}/g" target/docs/*.md
sed -i -e "s/@version@/${VERSION}/g" target/docs/*.md

exit 0
4 changes: 3 additions & 1 deletion job-dsl-plugin/pom.xml
Expand Up @@ -45,11 +45,12 @@
</developers>
<distributionManagement>
<site>
<id>github</id>
<id>github.com</id>
<url>scm:git:git@github.com:${gitHubUser}/job-dsl-plugin.git</url>
</site>
</distributionManagement>
<properties>
<gitHubUser>jenkinsci</gitHubUser>
<!-- TODO GMavenPlus does not support Javadoc -->
<maven.javadoc.skip>true</maven.javadoc.skip>
<node.version>18.14.2</node.version>
Expand Down Expand Up @@ -476,6 +477,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<checkinComment>updated gh-pages for ${project.version}</checkinComment>
<scmBranch>gh-pages</scmBranch>
Expand Down
21 changes: 0 additions & 21 deletions pom.xml
Expand Up @@ -29,16 +29,9 @@
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>
<distributionManagement>
<site>
<id>github</id>
<url>scm:git:git@github.com:${gitHubUser}/job-dsl-plugin.wiki.git</url>
</site>
</distributionManagement>
<properties>
<revision>1.82</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubUser>jenkinsci</gitHubUser>
<gitHubRepo>jenkinsci/job-dsl-plugin</gitHubRepo>
<jenkins.version>2.361.4</jenkins.version>
<!-- TODO fix violations -->
Expand Down Expand Up @@ -101,11 +94,6 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand All @@ -117,15 +105,6 @@
<tagNameFormat>job-dsl-@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<configuration>
<checkinComment>updated wiki for ${project.version}</checkinComment>
<scmBranch>master</scmBranch>
<!-- TODO generate the wiki from docs/*.md replacing version with project.version and jenkinsVersion with jenkins.version -->
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 71ce943

Please sign in to comment.