Switch from github maven packages to maven central (#7)

pull/10/head v0.1.1
Michael Barry 2021-10-25 14:07:48 -04:00 zatwierdzone przez GitHub
rodzic c2260ce05a
commit e402a3333b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
7 zmienionych plików z 33 dodań i 33 usunięć

Wyświetl plik

@ -51,17 +51,9 @@ jobs:
with: with:
java-version: 17 java-version: 17
distribution: 'temurin' distribution: 'temurin'
# do not cache to ensure we can resolve dependencies
server-id: 'github-flatmap'
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build and test - name: Build and test
run: mvn --batch-mode -no-transfer-progress package --file pom.xml run: mvn --batch-mode -no-transfer-progress package --file pom.xml
working-directory: flatmap-examples working-directory: flatmap-examples
# workaround for github maven packages not supporting anonymous access
env:
MAVEN_USERNAME: 'flatmapbot'
MAVEN_PASSWORD: '${{ secrets.PACKAGE_TOKEN }}'
- name: Find jar - name: Find jar
run: mv target/*with-deps.jar ./run.jar run: mv target/*with-deps.jar ./run.jar
working-directory: flatmap-examples working-directory: flatmap-examples

Wyświetl plik

@ -33,6 +33,9 @@ jobs:
java-version: '17' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
cache: 'maven' cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Check tag does not exist yet - name: Check tag does not exist yet
run: if git rev-list "v${{ github.event.inputs.version }}"; then echo "Tag already exists. Aborting the release process."; exit 1; fi run: if git rev-list "v${{ github.event.inputs.version }}"; then echo "Tag already exists. Aborting the release process."; exit 1; fi
@ -60,6 +63,9 @@ jobs:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Install GPG Private Key
run: |
echo -n "${{ secrets.OSSRH_GPG_SECRET_KEY }}" | base64 --decode | gpg --batch --import
- name: Create Release - name: Create Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
@ -74,3 +80,6 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_TAGS: ${{ github.event.inputs.image_tags }} IMAGE_TAGS: ${{ github.event.inputs.image_tags }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

Wyświetl plik

@ -28,6 +28,9 @@ jobs:
java-version: 17 java-version: 17
distribution: 'temurin' distribution: 'temurin'
cache: 'maven' cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- run: ./scripts/build-release.sh - run: ./scripts/build-release.sh
- run: ./scripts/test-release.sh - run: ./scripts/test-release.sh
- name: Log in to the Container Registry - name: Log in to the Container Registry
@ -36,7 +39,13 @@ jobs:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Install GPG Private Key
run: |
echo -n "${{ secrets.OSSRH_GPG_SECRET_KEY }}" | base64 --decode | gpg --batch --import
- run: ./scripts/push-release.sh - run: ./scripts/push-release.sh
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_TAGS: ${{ github.event.inputs.image_tags }} IMAGE_TAGS: ${{ github.event.inputs.image_tags }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

Wyświetl plik

@ -36,20 +36,6 @@ First, make a copy of this example project. It contains:
- [src/test/java/com/onthegomap/flatmap/examples](src/main/java/com/onthegomap/flatmap/examples) - [src/test/java/com/onthegomap/flatmap/examples](src/main/java/com/onthegomap/flatmap/examples)
unit and integration tests for each of the map generators unit and integration tests for each of the map generators
Until Flatmap gets into Maven Central, to resolve `flatmap-core` dependencies, you will need to create
a [GitHub personal access token](https://github.com/settings/tokens) with `read:packages` scope, then add the following
to your `~/.m2/settings.xml`:
```xml
<servers>
<server>
<id>github-flatmap</id>
<username>username</username>
<password>token</password>
</server>
</servers>
```
Then, create a new class that implements `com.onthegomap.flatmap.Profile`: Then, create a new class that implements `com.onthegomap.flatmap.Profile`:
```java ```java

Wyświetl plik

@ -36,15 +36,15 @@
<enabled>true</enabled> <enabled>true</enabled>
</releases> </releases>
</repository> </repository>
<!-- TODO get flatmap into maven central and remove this: -->
<repository> <repository>
<id>github-flatmap</id> <id>nexus-snapshots</id>
<url>https://maven.pkg.github.com/onthegomap/flatmap</url> <name>Nexus SNAPSHOT Repository</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots> <snapshots>
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
<releases> <releases>
<enabled>true</enabled> <enabled>false</enabled>
</releases> </releases>
</repository> </repository>
</repositories> </repositories>

14
pom.xml
Wyświetl plik

@ -64,10 +64,13 @@
</repositories> </repositories>
<distributionManagement> <distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository> <repository>
<id>github</id> <id>ossrh</id>
<name>GitHub Packages</name> <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<url>https://maven.pkg.github.com/onthegomap/flatmap</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
@ -227,8 +230,8 @@
<id>attach-sources</id> <id>attach-sources</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>jar</goal> <goal>jar-no-fork</goal>
<goal>test-jar</goal> <goal>test-jar-no-fork</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
@ -286,6 +289,7 @@
<id>attach-sources</id> <id>attach-sources</id>
<goals> <goals>
<goal>jar-no-fork</goal> <goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>

Wyświetl plik

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euxo pipefail set -euo pipefail
version="${1:-$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)}" version="${1:-$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)}"
@ -13,4 +13,4 @@ do
docker image push ghcr.io/onthegomap/flatmap:"${TAG}" docker image push ghcr.io/onthegomap/flatmap:"${TAG}"
done done
./mvnw -B -DskipTests deploy ./mvnw -B -Dgpg.passphrase="${OSSRH_GPG_SECRET_KEY_PASSWORD}" -DskipTests -Prelease deploy