Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/publish-to-code-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish to CodeArtifact

on:
release:
types: [published]

env:
AWS_REGION: us-east-1

jobs:
publish:
runs-on:
group: Infrastructure
labels: [self-hosted, linux, arm64]

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up JDK
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
java-version: '17'
distribution: 'corretto'

- name: Login to CodeArtifact
run: |
export CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
--domain ${{ vars.CODEARTIFACT_DOMAIN }} \
--domain-owner ${{ vars.CODEARTIFACT_DOMAIN_OWNER }} \
--region ${{ env.AWS_REGION }} \
--query authorizationToken \
--output text)
echo "CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN" >> $GITHUB_ENV

- name: Build with Gradle
run: ./gradlew build

- name: Run tests
run: ./gradlew test

- name: Publish to CodeArtifact
run: ./gradlew publish
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,32 @@ Beanie is a simple library to sanity-check your bean ser-deser. Beanie catches a

## Installation

Unfortunately, Beanie is not available in any public Maven repositories except the GitHub Package Registry. For more information on how to install packages
from the GitHub Package
Registry, [https://docs.github.com/en/packages/guides/configuring-gradle-for-use-with-github-packages#installing-a-package][see the GitHub docs]
Beanie artifacts are published to AWS CodeArtifact. Before building, fetch a temporary token and expose it to Gradle (tokens expire after 12 hours):

```
export CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
--domain <your-domain> \
--domain-owner <your-domain-owner-account-id> \
--region us-east-1 \
--query authorizationToken \
--output text)
```

Then add the CodeArtifact repository to your `repositories` block:

```
repositories {
maven {
url = uri("https://nosto-673366506863.d.codeartifact.us-east-1.amazonaws.com/maven/java/")
credentials {
username = "aws"
password = System.getenv("CODEARTIFACT_AUTH_TOKEN")
}
}
}
```

After the repository is configured, declare the Beanie modules you need in `dependencies` as usual.

## Usage

Expand Down
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,12 @@ allprojects { project ->
publishing {
repositories {
maven {
name = "github"
url = uri("https://maven.pkg.github.com/nosto/beanie")
credentials(PasswordCredentials)
name = "codeartifact"
url = uri("https://nosto-673366506863.d.codeartifact.us-east-1.amazonaws.com/maven/java/")
credentials {
username = "aws"
password = System.getenv("CODEARTIFACT_AUTH_TOKEN")
}
}
}
publications {
Expand Down
Loading