Skip to content

Commit c1b83dc

Browse files
rhoeggactions-user
andauthored
Fix GitHub Actions permissions for Maven release (#37)
* Fix GitHub Actions permissions for Maven release - Add 'contents: write' permission to allow pushing commits - Explicitly use GITHUB_TOKEN in checkout action - Remove pinentry-mode config from maven-gpg-plugin (use env var instead) - Fixes git push permission denied error during release:prepare * Configure git to use HTTPS with token for authentication - Add git config to rewrite SSH URLs to HTTPS with token - Add fetch-depth: 0 for full history (needed for release plugin) - Fixes SSH permission denied error during git push * Simplify git authentication for maven-release-plugin - Use persist-credentials: false in checkout - Set remote URL with token in Configure Git step - Remove complex URL rewriting - Keep fetch-depth: 0 for release plugin to access full history * Fix Maven SCM URLs and git credentials - Change SCM URLs from SSH to HTTPS in pom.xml - Configure git credential helper with GitHub token - Maven-release-plugin uses SCM URLs, not git remote * [maven-release-plugin] prepare release json-logger-3.0.1 * [maven-release-plugin] prepare for next development iteration --------- Co-authored-by: GitHub Actions <[email protected]>
1 parent e2e7bb7 commit c1b83dc

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

.github/workflows/maven-release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ on:
66
jobs:
77
release:
88
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
911

1012
steps:
1113
- name: Checkout code
1214
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
fetch-depth: 0
1318

1419
- name: Set up JDK 17
1520
uses: actions/setup-java@v4
@@ -25,6 +30,8 @@ jobs:
2530
run: |
2631
git config user.name "GitHub Actions"
2732
git config user.email "[email protected]"
33+
git config credential.helper 'store --file ~/.git-credentials'
34+
echo "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com" > ~/.git-credentials
2835
2936
- name: Set up Maven settings.xml
3037
uses: s4u/maven-settings-action@v2

pom.xml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>cloud.anypoint</groupId>
66
<artifactId>json-logger</artifactId>
7-
<version>3.0.1-SNAPSHOT</version>
7+
<version>3.0.2-SNAPSHOT</version>
88
<packaging>mule-extension</packaging>
99
<name>JSON Logger</name>
1010

@@ -175,8 +175,8 @@
175175
</dependencies>
176176

177177
<scm>
178-
<connection>scm:git:git@github.com:anypointcloud/json-logger.git</connection>
179-
<developerConnection>scm:git:git@github.com:anypointcloud/json-logger.git</developerConnection>
178+
<connection>scm:git:https://github.com/anypointcloud/json-logger.git</connection>
179+
<developerConnection>scm:git:https://github.com/anypointcloud/json-logger.git</developerConnection>
180180
<url>https://github.com/anypointcloud/json-logger</url>
181181
<tag>HEAD</tag>
182182
</scm>
@@ -197,13 +197,7 @@
197197
<plugin>
198198
<groupId>org.apache.maven.plugins</groupId>
199199
<artifactId>maven-gpg-plugin</artifactId>
200-
<version>3.1.0</version>
201-
<configuration>
202-
<gpgArguments>
203-
<arg>--pinentry-mode</arg>
204-
<arg>loopback</arg>
205-
</gpgArguments>
206-
</configuration>
200+
<version>3.2.8</version>
207201
<executions>
208202
<execution>
209203
<id>sign-artifacts</id>

0 commit comments

Comments
 (0)