diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..6bbcb58c --- /dev/null +++ b/.github/workflows/release.yml @@ -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/setup-maven@v4.5 + with: + maven-version: 3.6.3 + + - name: Publish to GitHub Packages + run: mvn --batch-mode deploy -P github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3973a7bf..1874557d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,5 +1,5 @@ name: Tests -run-name: "Build, tests and package" +run-name: "Build, run tests, package and deploy" on: push: @@ -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 \ No newline at end of file + 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 }} diff --git a/klass-api/pom.xml b/klass-api/pom.xml index b30fcb49..a6dc2500 100644 --- a/klass-api/pom.xml +++ b/klass-api/pom.xml @@ -16,7 +16,6 @@ ${project.build.directory}/generated-snippets - false diff --git a/klass-forvaltning/pom.xml b/klass-forvaltning/pom.xml index 29f25959..017e4f55 100644 --- a/klass-forvaltning/pom.xml +++ b/klass-forvaltning/pom.xml @@ -7,10 +7,6 @@ klass-forvaltning war - - false - - no.ssb.klass klass-root diff --git a/klass-solr/pom.xml b/klass-solr/pom.xml index 162cf447..e2a866aa 100644 --- a/klass-solr/pom.xml +++ b/klass-solr/pom.xml @@ -6,10 +6,6 @@ klass-solr jar - - true - - no.ssb.klass klass-root diff --git a/pom.xml b/pom.xml index 1660ad2d..5a4b883b 100644 --- a/pom.xml +++ b/pom.xml @@ -22,27 +22,17 @@ - scm:git:https://github.com/statisticsnorway/klass.git + scm:git:https://github.com/${github.repository}.git + https://github.com/${github.repository} HEAD - - - releases - https://nexus.ssb.no/repository/maven-releases - - - snapshots - https://nexus.ssb.no/repository/maven-snapshots - false - - - 1.8 UTF-8 UTF-8 + statisticsnorway/klass 3.0.2 2.17 5.5.5 @@ -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 --> 1.2.1.RELEASE - - true - @@ -148,6 +135,18 @@ nexus + + + releases + https://nexus.ssb.no/repository/maven-releases + + + snapshots + https://nexus.ssb.no/repository/maven-snapshots + false + + + ssb-repo @@ -156,6 +155,26 @@ + + github + + + github + GitHub Packages + https://maven.pkg.github.com/${github.repository} + + true + + + + + + maven-restlet + Public online Restlet repository + https://maven.restlet.talend.com + + +