Skip to content

Commit

Permalink
WS-3234 Migrate module to GH and configure GCP artifacts registry for…
Browse files Browse the repository at this point in the history
… releases
  • Loading branch information
tomaszmichalak committed May 16, 2024
1 parent a3e5a12 commit ccc2b13
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 122 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright (C) 2022 Dynamic Solutions
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: "Release: Release and publish artifacts to GCP Artifacts Registry"

on:
workflow_dispatch:

permissions:
id-token: write
contents: read

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_RELEASES_RELEASE_DEPLOY_SA }}

- name: Configure Git
run: |
git remote set-url origin git@github.com:${{ github.repository }}.git
git config --global user.email "github.actions@ds.pl"
git config --global user.name "GitHub Actions"
mkdir -p ~/.ssh
printf '%s\n' "${{ secrets.GIT_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Release to GCP Artifacts Registry
run: mvn -B release:prepare release:perform -Darguments="-Dbnd.baseline.skip=true"
30 changes: 22 additions & 8 deletions .github/workflows/ci.yml → .github/workflows/ci-verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,47 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: CI
name: "Test: Verify module"

on:
workflow_dispatch:
pull_request:
push:
branches:
- main


permissions:
id-token: write
contents: read

jobs:
build-and-test:
verify:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ secrets.GCP_WEBSIGHT_RELEASES_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_WEBSIGHT_RELEASES_RELEASE_DEPLOY_SA }}

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Verify
run: |
mkdir .maven
mvn -B -DdryRun=true release:prepare
run: mvn -B verify -Dbnd.baseline.skip=true
77 changes: 0 additions & 77 deletions .github/workflows/release.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>com.google.cloud.artifactregistry</groupId>
<artifactId>artifactregistry-maven-wagon</artifactId>
<version>2.2.1</version>
</extension>
</extensions>
64 changes: 27 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@
</organization>

<repositories>
<repository>
<id>websight-repo</id>
<url>https://repo.websight.io/maven/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>artifact-registry</id>
<url>artifactregistry://europe-west1-maven.pkg.dev/websight-io/websight-maven-releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<properties>
Expand Down Expand Up @@ -89,9 +92,9 @@
</plugins>
<extensions>
<extension>
<groupId>com.github.seahen</groupId>
<artifactId>maven-s3-wagon</artifactId>
<version>1.3.3</version>
<groupId>com.google.cloud.artifactregistry</groupId>
<artifactId>artifactregistry-maven-wagon</artifactId>
<version>2.2.1</version>
</extension>
</extensions>
</build>
Expand Down Expand Up @@ -167,31 +170,18 @@

<profiles>
<profile>
<id>code-artifact-distribution</id>
<distributionManagement>
<repository>
<id>ws-code-artifact-repo</id>
<name>ws-code-artifact-repo</name>
<url>https://websight-${env.AWS_ACCOUNT_ID}.d.codeartifact.eu-central-1.amazonaws.com/maven/maven-repo/</url>
</repository>
<snapshotRepository>
<id>ws-code-artifact-snapshot-repo</id>
<name>ws-code-artifact-snapshot-repo</name>
<url>https://websight-internal-${env.AWS_ACCOUNT_ID}.d.codeartifact.eu-central-1.amazonaws.com/maven/maven-snapshot-repo/</url>
</snapshotRepository>
</distributionManagement>
<id>baseline</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-baseline-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>s3-distribution</id>
<distributionManagement>
<repository>
<id>ws-s3-repo</id>
<name>ws-s3-repo</name>
<url>s3://repo.websight.io/maven</url>
</repository>
</distributionManagement>
</profile>
</profiles>

</project>
</profiles>
</project>

0 comments on commit ccc2b13

Please sign in to comment.