Skip to content

Commit 3f93d3f

Browse files
committed
jector-publish: GitHub CI/CD publish-scripts
* new file: .github/workflows/build-deploy.yml * new file: .github/workflows/build-test.yml * new file: helper-scripts/abstract/abstract-checksum-generator.sh * new file: helper-scripts/abstract/abstract-move-files.sh * new file: helper-scripts/abstract/abstract-sonatype-publish.sh * new file: helper-scripts/project-impl/publishing/avrsandbox.pub * new file: helper-scripts/project-impl/publishing/install-maven-latest.sh * new file: helper-scripts/project-impl/publishing/maven-settings.xml * new file: helper-scripts/project-impl/publishing/owner-trust.txt * new file: helper-scripts/project-impl/publishing/secret-key * new file: helper-scripts/project-impl/publishing/sonatype-publish-artifacts.sh * new file: helper-scripts/project-impl/variables.sh
1 parent 20666b5 commit 3f93d3f

12 files changed

Lines changed: 416 additions & 0 deletions

.github/workflows/build-deploy.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# This workflow builds the API and releases it to Maven-Sonatype-Central repository
2+
3+
name: Build and deploy Jector
4+
5+
# Runs this workflow [on-release] only
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "master" branch
8+
release:
9+
types: [published]
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
jobs:
20+
compile-assemble:
21+
# runner images with architectures (variants)
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
matrix:
25+
os: [ 'ubuntu-latest' ]
26+
name: Compile java and jector jar
27+
28+
# Steps represent a sequence of tasks that will be executed as part of the job
29+
steps:
30+
- name: Checkout Job
31+
uses: actions/checkout@v3
32+
33+
- name: Setup Temurin-OpenJDK-19
34+
uses: actions/setup-java@v3
35+
with:
36+
distribution: 'temurin'
37+
java-version: '19'
38+
39+
- name: Compiling java
40+
run: ./gradlew --console="verbose" -Pversion=${GITHUB_REF_NAME} :jector:build
41+
42+
- name: Archive build
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: automata4j-build
46+
path: automata4j/build/libs
47+
48+
deploy:
49+
environment:
50+
name: maven-central
51+
url: https://repo.maven.apache.org/maven2/io/github/software-hardware-codesign/
52+
runs-on: ${{ matrix.os }}
53+
needs: [compile-assemble]
54+
strategy:
55+
matrix:
56+
os: [ 'ubuntu-latest' ]
57+
name: Deploying to Maven-Central repository
58+
59+
# Steps represent a sequence of tasks that will be executed as part of the job
60+
steps:
61+
- name: Checkout Job
62+
uses: actions/checkout@v3
63+
64+
- name: Setup Temurin-OpenJDK-19
65+
uses: actions/setup-java@v3
66+
with:
67+
distribution: 'temurin'
68+
java-version: '19'
69+
70+
- name: Setup maven-3.9
71+
run: |
72+
# remove shipped maven-3.8 that causes the plexus plugin incompatibility behavior
73+
sudo apt remove maven
74+
# installs maven-3.9 with the fixed plugins patch
75+
chmod +rwx ./helper-scripts/project-impl/publishing/install-maven-latest.sh
76+
./helper-scripts/project-impl/publishing/install-maven-latest.sh
77+
78+
- name: Use Predefined PGP Keybox
79+
run: gpg --import ./helper-scripts/project-impl/publishing/avrsandbox.pub
80+
81+
- name: Import secret-key
82+
run: gpg --allow-secret-key-import --import --batch --yes --passphrase="avrsandbox" ./helper-scripts/project-impl/publishing/secret-key
83+
84+
- name: Import owner-trust
85+
run: gpg --import-ownertrust ./helper-scripts/project-impl/publishing/owner-trust.txt
86+
87+
- name: Send public key 'avrsandbox'
88+
# sends the public key to a maven compatible host
89+
run: gpg --keyserver keyserver.ubuntu.com --send-keys 85A57D4975B6EE2B6D0EA46903DE10B9F12F0B20
90+
91+
- name: Generate sources jar
92+
run: ./gradlew -Pversion=$GITHUB_REF_NAME :jector:generateSourcesJar
93+
94+
- name: Generate javadoc jar
95+
run: ./gradlew -Pversion=$GITHUB_REF_NAME :jector:generateJavadocJar
96+
97+
- name: Download build
98+
uses: actions/download-artifact@v3
99+
with:
100+
name: automata4j-build
101+
path: automata4j/build/libs/
102+
103+
- name: Deploying automata4j binaries
104+
env:
105+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
106+
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
107+
run: |
108+
chmod +rwx ./helper-scripts/project-impl/publishing/sonatype-publish-artifacts.sh
109+
# publish artifacts using the tag version
110+
./helper-scripts/project-impl/publishing/sonatype-publish-artifacts.sh $GITHUB_REF_NAME
111+
112+
# deploy-doc:
113+
# environment:
114+
# name: release-documentation
115+
# url: ${{ steps.deployment.outputs.page_url }}
116+
# runs-on: ubuntu-latest
117+
118+
# steps:
119+
# - name: Checkout
120+
# uses: actions/checkout@v3
121+
122+
# - name: Generate javadoc
123+
# run: chmod +rwx ./gradlew && ./gradlew :jme3-alloc:generateJavadocJar
124+
125+
# - name: Move javadocs to the deployment folder 'website'
126+
# run: ./gradlew -Pversion=${GITHUB_REF_NAME} :jme3-alloc:manipulateJavadocForWebsite
127+
128+
# - name: Setup Pages
129+
# uses: actions/configure-pages@v3
130+
131+
# - name: Build with Jekyll
132+
# uses: actions/jekyll-build-pages@v1
133+
# with:
134+
# source: ./website
135+
# destination: ./_site
136+
137+
# - name: Upload artifact
138+
# uses: actions/upload-pages-artifact@v1
139+
140+
# - name: Deploy to GitHub Pages
141+
# id: deployment
142+
# uses: actions/deploy-pages@v1

.github/workflows/build-test.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build and Test Jector
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "master" branch
8+
push:
9+
branches: [ "master" ]
10+
pull_request:
11+
branches: [ "master" ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
jobs:
17+
build-jector:
18+
# runner images with architectures (variants)
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
matrix:
22+
os: [ 'ubuntu-latest' ]
23+
name: Build jector
24+
25+
# Steps represent a sequence of tasks that will be executed as part of the job
26+
steps:
27+
- name: Checkout Job
28+
uses: actions/checkout@v3
29+
30+
- name: Setup Temurin-JDK-19
31+
uses: actions/setup-java@v3
32+
with:
33+
distribution: 'temurin'
34+
java-version: '19'
35+
36+
- name: Compiling java
37+
run: ./gradlew --console="verbose" :jector:build
38+
39+
- name: Archive build
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: jector-snapshot
43+
path: jector/build/libs/
44+
45+
test-doc-generation:
46+
# a linux runner image with the ndk installed and llvm ready to compile android native binaries
47+
runs-on: ${{ matrix.os }}
48+
strategy:
49+
matrix:
50+
os: [ 'ubuntu-latest' ]
51+
name: Generating documentation
52+
53+
# Steps represent a sequence of tasks that will be executed as part of the job
54+
steps:
55+
- name: Checkout Job
56+
uses: actions/checkout@v3
57+
58+
- name: Setup Oracle-JDK-19
59+
uses: actions/setup-java@v3
60+
with:
61+
distribution: 'temurin'
62+
java-version: '19'
63+
64+
- name: Generate javadoc
65+
run: chmod +rwx ./gradlew && ./gradlew :jector:generateJavadocJar
66+
67+
test:
68+
# runner images with architectures (variants)
69+
runs-on: ${{ matrix.os }}
70+
needs: build-jector
71+
strategy:
72+
matrix:
73+
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
74+
name: Testing jector on ${{ matrix.os }} for x86-64
75+
76+
# Steps represent a sequence of tasks that will be executed as part of the job
77+
steps:
78+
- name: Checkout Job
79+
uses: actions/checkout@v3
80+
81+
- name: Setup Temurin-JDK-19
82+
uses: actions/setup-java@v3
83+
with:
84+
distribution: 'temurin'
85+
java-version: '19'
86+
87+
- name: Download jector-SNAPSHOT.jar library
88+
uses: actions/download-artifact@v3
89+
with:
90+
name: jector-snapshot
91+
path: jector/build/libs/
92+
93+
- name: Run jector example
94+
run: ./gradlew :jector-examples:run
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
function getMd5Checksum() {
4+
local input=$1
5+
local output=$2
6+
7+
md5sum "$input" > "$output"
8+
9+
return $?
10+
}
11+
12+
function getSha1Checksum() {
13+
local input=$1
14+
local output=$2
15+
16+
sha1sum "$input" > "$output"
17+
18+
return $?
19+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
function move() {
4+
local src=$1
5+
local dest=$2
6+
7+
mv -uv $src $dest
8+
9+
return $?
10+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
function generateGenericPom() {
4+
local groupId=$1
5+
local artifactId=$2
6+
local version=$3
7+
local name=$4
8+
local description=$5
9+
local url=$6
10+
local license_name=$7
11+
local license_url=$8
12+
local developer_name=$9
13+
local developer_mail=${10}
14+
local organization_name=${11}
15+
local organization_url=${12}
16+
local scm_conn=${13}
17+
local output=${14}
18+
19+
config="<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd\"> \
20+
<modelVersion>4.0.0</modelVersion> \
21+
<groupId>${groupId}</groupId> \
22+
<artifactId>${artifactId}</artifactId> \
23+
<version>${version}</version> \
24+
<name>${name}</name> \
25+
<packaging>jar</packaging> \
26+
<description>${description}</description> \
27+
<url>${url}</url> \
28+
<licenses> \
29+
<license> \
30+
<name>${license_name}</name> \
31+
<url>${license_url}</url> \
32+
</license> \
33+
</licenses> \
34+
<developers> \
35+
<developer> \
36+
<name>${developer_name}</name> \
37+
<email>${developer_mail}</email> \
38+
<organization>${organization_name}</organization> \
39+
<organizationUrl>${organization_url}</organizationUrl> \
40+
</developer> \
41+
</developers> \
42+
<scm> \
43+
<connection>${scm_conn}</connection> \
44+
<developerConnection>${scm_conn}</developerConnection> \
45+
<url>${url}</url> \
46+
</scm> \
47+
</project> \
48+
"
49+
echo $config > ${output}
50+
}
51+
52+
function publishBuild() {
53+
local artifactId=$1
54+
local artifact=$2
55+
local version=$3
56+
local javadoc_jar=$4
57+
local sources_jar=$5
58+
local pomFile=$6
59+
60+
${maven_bin} gpg:sign-and-deploy-file -s ${settings} -Durl=${sonatype_url} \
61+
-DartifactId=${artifactId} \
62+
-DrepositoryId=${repository} \
63+
-Dversion=${version} \
64+
-DpomFile=${pomFile} \
65+
-Dgpg.passphrase=${passphrase} \
66+
-Dfile=${artifact} \
67+
-Djavadoc=${javadoc_jar} \
68+
-Dsources=${sources_jar}
69+
70+
71+
return $?
72+
}
1.74 KB
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
source "./helper-scripts/project-impl/variables.sh"
4+
5+
function downloadMavenLatest() {
6+
wget "https://dlcdn.apache.org/maven/maven-3/${maven_version}/binaries/apache-maven-${maven_version}-bin.tar.gz"
7+
return $?
8+
}
9+
10+
function extractMavenLatest() {
11+
tar xzvf "./apache-maven-${maven_version}-bin.tar.gz"
12+
return $?
13+
}
14+
15+
downloadMavenLatest
16+
extractMavenLatest
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
4+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
<servers>
6+
<server>
7+
<id>ossrh</id>
8+
<username>${env.OSSRH_USERNAME}</username>
9+
<password>${env.OSSRH_TOKEN}</password>
10+
</server>
11+
</servers>
12+
</settings>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# List of assigned trustvalues, created Thu 13 Jul 2023 12:01:36 AM EAT
2+
# (Use "gpg --import-ownertrust" to restore them)
3+
85A57D4975B6EE2B6D0EA46903DE10B9F12F0B20:6:
3.73 KB
Binary file not shown.

0 commit comments

Comments
 (0)