Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push snapshots and releases to Github Packages. #154

Merged
merged 14 commits into from
Jan 11, 2024
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release
run-name: "Release to github packages"

on:
release:
types: [ created ]

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'
cache: maven

# Need to downgrade Maven in order to allow HTTP (not HTTPS) packages to be downloaded.
# This is necessary as HTTP repositories were blocked in Maven 3.8.1
# HTTP repositories are used in some outdated dependenciesns
# This step can be removed once KLASS packages have been updated to more recent versions
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.6.3

- name: Publish to GitHub Packages
run: mvn --batch-mode deploy -P github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 23 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Tests
run-name: "Build, tests and package"
run-name: "Build, run tests, package and deploy"

on:
push:
Expand Down Expand Up @@ -35,4 +35,25 @@ jobs:
maven-version: 3.6.3

- name: Build, test and package with Maven
run: mvn --batch-mode --update-snapshots package -P nexus
run: mvn --batch-mode --update-snapshots package -P nexus

deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'
cache: maven

- name: Publish to GitHub Packages
run: mvn --batch-mode deploy -P github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion klass-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

<properties>
<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>


Expand Down
4 changes: 0 additions & 4 deletions klass-forvaltning/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
<artifactId>klass-forvaltning</artifactId>
<packaging>war</packaging>

<properties>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>

<parent>
<groupId>no.ssb.klass</groupId>
<artifactId>klass-root</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions klass-solr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
<artifactId>klass-solr</artifactId>
<packaging>jar</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<parent>
<groupId>no.ssb.klass</groupId>
<artifactId>klass-root</artifactId>
Expand Down
51 changes: 35 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,17 @@
</modules>

<scm>
<developerConnection>scm:git:https://github.com/statisticsnorway/klass.git</developerConnection>
<developerConnection>scm:git:https://github.com/${github.repository}.git</developerConnection>
<url>https://github.com/${github.repository}</url>
<tag>HEAD</tag>
</scm>

<distributionManagement>
<repository>
<id>releases</id>
<url>https://nexus.ssb.no/repository/maven-releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>https://nexus.ssb.no/repository/maven-snapshots</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>

<properties>

<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.repository>statisticsnorway/klass</github.repository>
<findbugs-version>3.0.2</findbugs-version>
<checkstyle-version>2.17</checkstyle-version>
<solr-version>5.5.5</solr-version>
Expand Down Expand Up @@ -76,9 +66,6 @@
forces us to downgrade to version 1.1.0. (https://github.com/spring-projects/spring-restdocs/issues/286)
Remove when Spring Boot includes version 1.1.2 or newer -->
<spring-restdocs.version>1.2.1.RELEASE</spring-restdocs.version>

<maven.deploy.skip>true</maven.deploy.skip>

</properties>

<dependencyManagement>
Expand Down Expand Up @@ -148,6 +135,18 @@
<profiles>
<profile>
<id>nexus</id>
<distributionManagement>
<repository>
<id>releases</id>
<url>https://nexus.ssb.no/repository/maven-releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>https://nexus.ssb.no/repository/maven-snapshots</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>

<repositories>
<repository>
<id>ssb-repo</id>
Expand All @@ -156,6 +155,26 @@
</repository>
</repositories>
</profile>
<profile>
<id>github</id>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/${github.repository}</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>https://maven.restlet.talend.com</url>
</repository>
</repositories>
</profile>
</profiles>

</project>
Loading