Skip to content

Commit 508fe20

Browse files
authored
ci: publish to GitLab Package Repository instead of GitHub as GitHub Packages does not allow unauthorized read access to Maven repository (#7) (#8)
Signed-off-by: Mart Somermaa <[email protected]> Co-authored-by: Mart Somermaa <[email protected]>
1 parent e6f9729 commit 508fe20

File tree

4 files changed

+35
-8
lines changed

4 files changed

+35
-8
lines changed

.github/gitlab-mvn-settings.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
3+
<servers>
4+
<server>
5+
<id>gitlab</id>
6+
<configuration>
7+
<httpHeaders>
8+
<property>
9+
<name>Deploy-Token</name>
10+
<value>${env.GITLAB_DEPLOY_TOKEN}</value>
11+
</property>
12+
</httpHeaders>
13+
</configuration>
14+
</server>
15+
</servers>
16+
</settings>

.github/workflows/maven-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ jobs:
2323
- name: Build
2424
run: mvn --batch-mode compile
2525

26-
- name: Test
27-
run: mvn --batch-mode verify
26+
- name: Test and package
27+
run: mvn --batch-mode package

.github/workflows/maven-deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy to Github Packages
1+
name: Deploy to GitLab Package Repository # Github Packages
22

33
on:
44
release:
@@ -22,7 +22,7 @@ jobs:
2222
key: ${{ runner.os }}-m2-v8-${{ hashFiles('**/pom.xml') }}
2323
restore-keys: ${{ runner.os }}-m2-v8
2424

25-
- name: Deploy to GitHub Packages
25+
- name: Deploy to GitLab Package Repository # GitHub Packages
2626
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
run: mvn --batch-mode deploy
27+
GITLAB_DEPLOY_TOKEN: ${{ secrets.GITLAB_DEPLOY_TOKEN }} # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: mvn --batch-mode -s .github/gitlab-mvn-settings.xml deploy

pom.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<dependency>
6666
<groupId>com.google.guava</groupId>
6767
<artifactId>guava</artifactId>
68-
<version>29.0-jre</version>
68+
<version>30.1-jre</version>
6969
</dependency>
7070
<dependency>
7171
<groupId>org.bouncycastle</groupId>
@@ -141,8 +141,10 @@
141141
</plugins>
142142
</build>
143143

144-
<!-- For publishing the library to GitHub Packages -->
144+
<!-- For publishing the library to GitHub Packages/GitLab Package Repository -->
145145
<distributionManagement>
146+
<!-- Github Packages does not currently support public access, so disabled until it does.
147+
See https://github.community/t/download-from-github-package-registry-without-authentication/14407
146148
<repository>
147149
<id>github</id>
148150
<url>https://maven.pkg.github.com/web-eid/web-eid-authtoken-validation-java</url>
@@ -151,6 +153,15 @@
151153
<id>github</id>
152154
<url>https://maven.pkg.github.com/web-eid/web-eid-authtoken-validation-java</url>
153155
</snapshotRepository>
156+
-->
157+
<repository>
158+
<id>gitlab</id>
159+
<url>https://gitlab.com/api/v4/projects/19948337/packages/maven</url>
160+
</repository>
161+
<snapshotRepository>
162+
<id>gitlab</id>
163+
<url>https://gitlab.com/api/v4/projects/19948337/packages/maven</url>
164+
</snapshotRepository>
154165
</distributionManagement>
155166

156167
</project>

0 commit comments

Comments
 (0)