Skip to content

Commit 471c3a6

Browse files
feat(v2): publish snapshots (#1655)
* Initial commit * Add distributionManagement back * Switch to environment variables * Enforcer should work * Re-enable GPG * Change user/password for publish * Missing config? * Skip SAM example for deploy * Another missing one * Publish preview docs * Update docs accordingly * Exclude intentional constructor throw from spotbugs * More new spotbugs? * Block new spotbugs rules * Remove PR push triggers * Again but properly --------- Co-authored-by: Jérôme Van Der Linden <[email protected]>
1 parent 12a2f44 commit 471c3a6

File tree

10 files changed

+145
-6
lines changed

10 files changed

+145
-6
lines changed
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Docs
2+
on:
3+
push:
4+
branches:
5+
- v2
6+
workflow_dispatch: {}
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
pages: write
12+
13+
jobs:
14+
docs:
15+
runs-on: ubuntu-latest
16+
environment: Docs
17+
steps:
18+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
19+
- name: Set up Python
20+
uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
21+
with:
22+
python-version: "3.8"
23+
- name: Capture branch and tag
24+
id: branch_name
25+
run: |
26+
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
27+
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
28+
- name: Build docs website
29+
run: |
30+
make build-docs-website
31+
- name: Configure AWS credentials
32+
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
33+
with:
34+
aws-region: us-east-1
35+
role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }}
36+
- name: Deploy Docs
37+
run: |
38+
aws s3 sync \
39+
dist \
40+
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-java/preview/
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish v2
2+
on:
3+
push:
4+
branches:
5+
- v2
6+
workflow_dispatch: {}
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
environment: snapshot
11+
steps:
12+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
13+
- name: Set up Maven Central Repository
14+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
15+
with:
16+
distribution: 'corretto'
17+
java-version: 11
18+
server-id: ossrh
19+
server-username: MAVEN_USERNAME
20+
server-password: MAVEN_PASSWORD
21+
# TODO: use environments https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
22+
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import
23+
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
24+
- name: Publish package
25+
run: mvn -Prelease clean validate deploy -DskipTests # We use validate here to run maven enforcer, to make sure we are only publishing SNAPSHOT builds
26+
env:
27+
MAVEN_USERNAME: ${{ secrets.SNAPSHOT_PUBLISH_USERNAME }}
28+
MAVEN_PASSWORD: ${{ secrets.SNAPSHOT_PUBLISH_PASSWORD }}
29+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
- name: Publish package
2828
run: mvn -Prelease clean deploy -DskipTests
2929
env:
30-
MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
31-
MAVEN_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}
30+
MAVEN_USERNAME: ${{ secrets.SNAPSHOT_PUBLISH_USERNAME }}
31+
MAVEN_PASSWORD: ${{ secrets.SNAPSHOT_PUBLISH_PASSWORD }}
3232
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
3333
- name: Close issues related to this release
3434
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1

docs/index.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ title: Homepage
33
description: Powertools for AWS Lambda (Java)
44
---
55

6-
![aws provider](https://img.shields.io/badge/provider-AWS-orange?logo=amazon-aws&color=ff9900) ![Build status](https://github.com/aws-powertools/powertools-lambda-java/actions/workflows/build.yml/badge.svg) ![Maven Central](https://img.shields.io/maven-central/v/software.amazon.lambda/powertools-parent)
6+
![aws provider](https://img.shields.io/badge/provider-AWS-orange?logo=amazon-aws&color=ff9900) ![Build status](https://github.com/aws-powertools/powertools-lambda-java/actions/workflows/publish-v2-snapshot.yml/badge.svg) ![Maven Central](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Faws.oss.sonatype.org%2Fcontent%2Frepositories%2Fsnapshots%2Fsoftware%2Famazon%2Flambda%2Fpowertools-parent%2Fmaven-metadata.xml
7+
)
8+
9+
???+ warning
10+
You are browsing the documentation for Powertools for AWS Lambda (Java) - v2. This is a snapshot release and not stable!
11+
Check out our stable [v1](https://docs.powertools.aws.dev/lambda/java/) documentation if this is not what you wanted.
12+
The v2 maven snapshot repository can be found [here](https://aws.oss.sonatype.org/content/repositories/snapshots/software/amazon/lambda/) .
713

814
Powertools for AWS Lambda (Java) is a suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier.
915

examples/powertools-examples-core-utilities/sam/pom.xml

+9
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@
113113
</dependency>
114114
</dependencies>
115115
</plugin>
116+
<!-- Don't deploy the example -->
117+
<plugin>
118+
<groupId>org.apache.maven.plugins</groupId>
119+
<artifactId>maven-deploy-plugin</artifactId>
120+
<version>3.1.2</version>
121+
<configuration>
122+
<skip>true</skip>
123+
</configuration>
124+
</plugin>
116125
</plugins>
117126
</build>
118127
</project>

examples/powertools-examples-core-utilities/serverless/pom.xml

+9
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@
114114
</dependency>
115115
</dependencies>
116116
</plugin>
117+
<!-- Don't deploy the example -->
118+
<plugin>
119+
<groupId>org.apache.maven.plugins</groupId>
120+
<artifactId>maven-deploy-plugin</artifactId>
121+
<version>3.1.2</version>
122+
<configuration>
123+
<skip>true</skip>
124+
</configuration>
125+
</plugin>
117126
</plugins>
118127
</build>
119128
</project>

mkdocs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
site_name: Powertools for AWS Lambda (Java)
2-
site_description: Powertools for AWS Lambda (Java)
1+
site_name: Powertools for AWS Lambda (Java) Preview
2+
site_description: Powertools for AWS Lambda (Java) Preview
33
site_author: Amazon Web Services
44
site_url: https://docs.powertools.aws.dev/lambda-java/
55
nav:
@@ -85,7 +85,7 @@ extra_javascript:
8585

8686
extra:
8787
powertools:
88-
version: 2.0.0 # to update after each release (we do not want snapshot version here)
88+
version: 2.0.0-SNAPSHOT
8989

9090
repo_url: https://github.com/aws-powertools/powertools-lambda-java
9191
edit_uri: edit/main/docs

pom.xml

+29
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@
9797
<project.rootdir>${maven.multiModuleProjectDirectory}</project.rootdir>
9898
</properties>
9999

100+
<distributionManagement>
101+
<snapshotRepository>
102+
<id>ossrh</id>
103+
<url>https://aws.oss.sonatype.org/content/repositories/snapshots</url>
104+
</snapshotRepository>
105+
</distributionManagement>
106+
100107
<dependencyManagement>
101108
<dependencies>
102109
<dependency>
@@ -457,6 +464,28 @@
457464
<id>release</id>
458465
<build>
459466
<plugins>
467+
<plugin>
468+
<groupId>org.apache.maven.plugins</groupId>
469+
<artifactId>maven-enforcer-plugin</artifactId>
470+
<version>3.5.0</version>
471+
<executions>
472+
<execution>
473+
<id>enforce-snapshot-versions</id>
474+
<phase>validate</phase>
475+
<goals>
476+
<goal>enforce</goal>
477+
</goals>
478+
<configuration>
479+
<rules>
480+
<requireSnapshotVersion>
481+
<message>Release build should not have snapshot dependencies!</message>
482+
</requireSnapshotVersion>
483+
</rules>
484+
<fail>true</fail>
485+
</configuration>
486+
</execution>
487+
</executions>
488+
</plugin>
460489
<plugin>
461490
<groupId>org.apache.maven.plugins</groupId>
462491
<artifactId>maven-gpg-plugin</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"installationId":"e43b8515-8484-485c-8315-bead4568972b","telemetryEnabled":"true"}

spotbugs-exclude.xml

+16
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html
99
-->
1010
<FindBugsFilter>
11+
<!-- These open matches are new rules that we have not yet addressed. Let's block them generically, and come
12+
back to them later. -->
13+
<Match>
14+
<Bug pattern="CT_CONSTRUCTOR_THROW" />
15+
</Match>
16+
<Match>
17+
<Bug pattern="PA_PUBLIC_PRIMITIVE_ATTRIBUTE" />
18+
</Match>
19+
<Match>
20+
<Bug pattern="SING_SINGLETON_GETTER_NOT_SYNCHRONIZED" />
21+
</Match>
22+
<Match>
23+
<Bug pattern="SING_SINGLETON_GETTER_NOT_SYNCHRONIZED" />
24+
</Match>
25+
26+
<!-- Regular matches -->
1127
<Match>
1228
<Bug pattern="EI_EXPOSE_REP2"/>
1329
<Or>

0 commit comments

Comments
 (0)