Skip to content

Commit f23c255

Browse files
authored
Initial revision (#1)
* Initial revision Signed-off-by: Laird Nelson <[email protected]> * Squashable commit; adds Github Actions support and Maven wrapper Signed-off-by: Laird Nelson <[email protected]> --------- Signed-off-by: Laird Nelson <[email protected]>
1 parent 0af69cb commit f23c255

19 files changed

+2454
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @ljnelson
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: 'Workflow: Maven Release: Prepare and Perform'
2+
run-name: 'Workflow Run: Maven Release: Prepare and Perform'
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dryRun:
7+
default: true
8+
description: 'Dry run?'
9+
type: 'boolean'
10+
mvnDebug:
11+
default: false
12+
description: 'Debug?'
13+
type: 'boolean'
14+
mvnTransferLogging:
15+
default: false
16+
description: 'Log Maven artifact transfers?'
17+
type: 'boolean'
18+
jobs:
19+
job-mvn-release-prepare-perform:
20+
name: 'Job: Maven Release: Prepare and Perform'
21+
permissions:
22+
contents: 'read'
23+
runs-on: 'ubuntu-latest'
24+
steps:
25+
- id: 'checkout'
26+
name: 'Step: Check Out Project'
27+
uses: 'actions/checkout@v4'
28+
with:
29+
fetch-depth: 1
30+
persist-credentials: false
31+
- id: 'setup-java'
32+
name: 'Step: Set Up Java and Maven'
33+
uses: 'actions/setup-java@v4'
34+
with:
35+
cache: 'maven'
36+
distribution: 'temurin'
37+
gpg-passphrase: 'GPG_PASSPHRASE'
38+
gpg-private-key: '${{ secrets.GPG_PRIVATE_KEY }}'
39+
java-version: '23'
40+
mvn-toolchain-id: 'Temurin 23'
41+
mvn-toolchain-vendor: 'openjdk' # see ../../pom.xml
42+
server-id: 'sonatype-oss-repository-hosting' # see https://github.com/microbean/microbean-parent/blob/master/pom.xml#L38
43+
server-password: 'SONATYPE_OSSRH_PASSWORD'
44+
server-username: 'SONATYPE_OSSRH_USERNAME'
45+
- id: 'setup-askpass'
46+
name: 'Step: Set Up GIT_ASKPASS'
47+
run: |
48+
install -m 700 /dev/null "${RUNNER_TEMP}/.askpass" # atomically create empty file with appropriate permissions
49+
cat >> "${RUNNER_TEMP}/.askpass" <<<'#!/bin/bash
50+
case "${1}" in
51+
Username*) exec echo x-access-token ;;
52+
Password*) exec echo "${PUSH_TOKEN}" ;;
53+
esac'
54+
- id: 'setup-gpg'
55+
name: 'Step: Set Up GPG'
56+
run: |
57+
echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf
58+
- id: 'mvn-release-prepare'
59+
name: 'Step: Maven Release: Prepare, Perform and Publish Site'
60+
env:
61+
DRY_RUN: '${{ inputs.dryRun }}'
62+
GIT_ASKPASS: '${{ runner.temp }}/.askpass'
63+
GPG_PASSPHRASE: '${{ secrets.GPG_PASSPHRASE }}'
64+
MVN_DEBUG: ${{ inputs.mvnDebug && '--debug' || '' }}
65+
MVN_TRANSFER_LOGGING: ${{ inputs.mvnTransferLogging && '' || '--no-transfer-progress' }}
66+
PUSH_TOKEN : '${{ secrets.PUSH_TOKEN }}' # critical; see ${GIT_ASKPASS} file
67+
SCM_GIT_HTTPS_URL: 'scm:git:${{ github.server_url }}/${{ github.repository }}.git'
68+
SONATYPE_OSSRH_PASSWORD: '${{ secrets.SONATYPE_OSSRH_PASSWORD }}'
69+
SONATYPE_OSSRH_STAGING_PROFILE_ID: '${{ vars.SONATYPE_OSSRH_STAGING_PROFILE_ID }}'
70+
SONATYPE_OSSRH_USERNAME: '${{ secrets.SONATYPE_OSSRH_USERNAME }}'
71+
shell: 'bash -e {0}'
72+
run: >
73+
git config --global user.email '[email protected]'
74+
75+
git config --global user.name 'microbean'
76+
77+
echo "::group::Running mvn prepare"
78+
79+
./mvnw --batch-mode ${MVN_DEBUG} --errors ${MVN_TRANSFER_LOGGING} release:prepare
80+
-DdryRun="${DRY_RUN}"
81+
-Darguments="${MVN_TRANSFER_LOGGING}"
82+
-Dscm.url="${SCM_GIT_HTTPS_URL}"
83+
84+
scm_tag="$(grep '^scm.tag=' release.properties | cut -f 2 -d =)"
85+
86+
echo "Prepared ${scm_tag}" >> "${GITHUB_STEP_SUMMARY}"
87+
88+
echo "scm_tag=${scm_tag}" >> "${GITHUB_OUTPUT}"
89+
90+
echo "::endgroup::"
91+
92+
echo "::group::Running mvn perform"
93+
94+
set +e
95+
96+
{
97+
./mvnw --batch-mode ${MVN_DEBUG} --errors ${MVN_TRANSFER_LOGGING} release:perform
98+
-Darguments="${MVN_TRANSFER_LOGGING} -Dscmpublish.dryRun=${DRY_RUN} -Dscmpublish.pubScmUrl=${SCM_GIT_HTTPS_URL} -DskipTests -DstagingProfileId=${SONATYPE_OSSRH_STAGING_PROFILE_ID}"
99+
-DdryRun="${DRY_RUN}"
100+
-Dgoals="process-classes,post-site,scm-publish:publish-scm,deploy"
101+
-Dscm.url="${SCM_GIT_HTTPS_URL}"
102+
|
103+
tee /dev/fd/3
104+
|
105+
grep --invert-match --silent 'Java class com.sonatype.nexus.staging.api.dto.StagingProfileRepositoryDTO' || cat > /dev/null
106+
;
107+
}
108+
3>&1
109+
110+
exit_codes=(${PIPESTATUS[@]})
111+
112+
echo "::endgroup::"
113+
114+
set -e
115+
116+
if [ "${exit_codes[2]}" -ne 0 ] ; then
117+
# grep "failed" (found com.sonatype.nexus.staging.api.dto.StagingProfileRepositoryDTO) and mvn failed
118+
echo "Released ${scm_tag} successfully, but verify that the staging repository was successfully released" >> "${GITHUB_STEP_SUMMARY}";
119+
# Treat this as a successful run
120+
exit 0;
121+
elif [ "${exit_codes[0]}" -eq 0 ] ; then
122+
# mvn succeeded and grep "succeeded" (did not find com.sonatype.nexus.staging.api.dto.StagingProfileRepositoryDTO)
123+
echo "Released ${scm_tag} successfully" >> "${GITHUB_STEP_SUMMARY}";
124+
fi
125+
126+
exit "${exit_codes[0]}"

.github/workflows/mvn-verify.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Workflow: Maven Verify'
2+
run-name: 'Workflow Run: Maven Verify'
3+
on:
4+
- 'pull_request'
5+
- 'push'
6+
jobs:
7+
job-mvn-verify:
8+
name: 'Job: Maven Verify'
9+
permissions:
10+
contents: 'read'
11+
runs-on: 'ubuntu-latest'
12+
steps:
13+
- id: 'checkout'
14+
name: 'Step: Checkout'
15+
uses: 'actions/checkout@v4'
16+
with:
17+
fetch-depth: 1
18+
persist-credentials: false
19+
- id: 'setup-java'
20+
name: 'Step: Set Up Java and Maven'
21+
uses: 'actions/setup-java@v4'
22+
with:
23+
cache: 'maven'
24+
distribution: 'temurin'
25+
java-version: '23'
26+
mvn-toolchain-id: 'Temurin 23'
27+
mvn-toolchain-vendor: 'openjdk' # see ../../pom.xml
28+
- id: 'mvn-verify'
29+
name: 'Step: Maven Verify'
30+
run: './mvnw --batch-mode --color never --errors --no-transfer-progress -Dorg.slf4j.simpleLogger.defaultLogLevel=info verify'

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
*.args
3+
*.class
4+
*~
5+
nbactions.xml
6+
nb-configuration.xml
7+
src/site/markdown/*.html
8+
target/
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
20+

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# microBean™ Proxy
2+
3+
[![Maven Central](https://img.shields.io/maven-central/v/org.microbean/microbean-proxy.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.microbean/microbean-proxy)
4+
5+
The microBean™ Proxy project provides classes and interfaces assisting with implementing proxy classes.
6+
7+
# Status
8+
9+
This project is currently experimental, in a pre-alpha state, and unsuitable for production use.
10+
11+
# Compatibility
12+
13+
**Until further notice, this project's APIs are subject to frequent backwards-incompatible signature and behavior
14+
changes, regardless of project version and without notice.**
15+
16+
# Requirements
17+
18+
microBean™ Proxy requires a Java runtime of version 21 or higher.
19+
20+
# Installation
21+
22+
microBean™ Proxy is available on [Maven
23+
Central](https://central.sonatype.com/artifact/org.microbean/microbean-proxy). Include microBean™ Proxy as a Maven
24+
dependency:
25+
26+
```xml
27+
<dependency>
28+
<groupId>org.microbean</groupId>
29+
<artifactId>microbean-proxy</artifactId>
30+
<!-- Always check https://central.sonatype.com/artifact/org.microbean/microbean-proxy for up-to-date available versions. -->
31+
<version>0.0.1</version>
32+
</dependency>
33+
```
34+
35+
# Documentation
36+
37+
Full documentation is available at
38+
[microbean.github.io/microbean-proxy](https://microbean.github.io/microbean-proxy/).

0 commit comments

Comments
 (0)