Skip to content

Commit 50c31e5

Browse files
authored
Merge pull request #126 from kang8/dev
[WIP] 添加发布快照的 workflow
2 parents 9a24553 + 9fc3131 commit 50c31e5

File tree

3 files changed

+55
-6
lines changed

3 files changed

+55
-6
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy SNAPSHOT
2+
3+
on:
4+
push:
5+
branches: [ dev ]
6+
paths:
7+
- src/**
8+
- pom.xml
9+
pull_request:
10+
branches: [ dev ]
11+
paths:
12+
- src/**
13+
- pom.xml
14+
15+
jobs:
16+
get-latest-tag:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/[email protected]
20+
- name: Set up Java and Maven
21+
uses: actions/setup-java@v2
22+
with:
23+
java-version: '8'
24+
distribution: 'adopt'
25+
server-id: ossrh
26+
server-username: MAVEN_USERNAME
27+
server-password: MAVEN_PASSWORD
28+
- name: Cache m2 package
29+
uses: actions/cache@v2
30+
with:
31+
path: ~/.m2/repository
32+
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
33+
restore-keys: |
34+
${{ runner.os }}-maven-
35+
- name: get current project version to set env.VERSION
36+
run: echo "VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`" >> $GITHUB_ENV
37+
- name: set snapshot version
38+
if: ${{ !endsWith( env.VERSION , '-SNAPSHOT') }}
39+
run: mvn versions:set -DnewVersion=${{ env.VERSION }}-SNAPSHOT
40+
- name: deploy snapshot to ossrh repository
41+
run: mvn -B deploy -P snapshot
42+
env:
43+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
44+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

pom.xml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@
157157
</plugins>
158158
</build>
159159
<profiles>
160+
<profile>
161+
<id>snapshot</id>
162+
<distributionManagement>
163+
<snapshotRepository>
164+
<id>ossrh</id>
165+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
166+
</snapshotRepository>
167+
</distributionManagement>
168+
</profile>
160169
<profile>
161170
<id>release</id>
162171
<build>
@@ -222,10 +231,6 @@
222231
</plugins>
223232
</build>
224233
<distributionManagement>
225-
<snapshotRepository>
226-
<id>sonatype-nexus-snapshots</id>
227-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
228-
</snapshotRepository>
229234
<repository>
230235
<id>sonatype-nexus-staging</id>
231236
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>

src/test/java/me/zhyd/oauth/utils/GlobalAuthUtilsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public void testGenerateTwitterSignatureForUserInfo() {
145145
oauthParams.forEach((k, v) -> oauthParams.put(k, "\"" + GlobalAuthUtils.urlEncode(v) + "\""));
146146

147147
String actual = "OAuth " + GlobalAuthUtils.parseMapToString(oauthParams, false).replaceAll("&", ", ");
148-
assertEquals("OAuth oauth_nonce=\"sTj7Ivg73u052eXstpoS1AWQCynuDEPN\", oauth_signature=\"yHHq2J1W5QLAO8gGipnY1V%2Bzxqk%3D\", oauth_token=\"1961977975-PcFQaCnpN9h9xqtqHwHlpGBXFrHJ9bOLy7OtGAL\", oauth_consumer_key=\"HD0XLqzi5Wz0G08rh45Cg8mgh\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1569751082\", oauth_version=\"1.0\"", actual);
148+
assertEquals("OAuth oauth_nonce=\"sTj7Ivg73u052eXstpoS1AWQCynuDEPN\", oauth_signature=\"OsqHjRmBf7syxlz8lB7MRdzqEjY%3D\", oauth_token=\"1961977975-PcFQaCnpN9h9xqtqHwHlpGBXFrHJ9bOLy7OtGAL\", oauth_consumer_key=\"HD0XLqzi5Wz0G08rh45Cg8mgh\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1569751082\", oauth_version=\"1.0\"", actual);
149149
}
150150

151151
@Test
@@ -200,7 +200,7 @@ public void generateTwitterSignature() {
200200
queryParams.put("name", "你好");
201201
queryParams.put("gender", "male");
202202

203-
assertEquals("J6MAQH1kcgUdj2jmygN3rdfI4lo=", GlobalAuthUtils.generateTwitterSignature(queryParams, "GET", TWITTER.userInfo(), "xxxxx", "xxxxx"));
203+
assertEquals("20FYnV2aZnxNQtp+I0tpMRTvcx0=", GlobalAuthUtils.generateTwitterSignature(queryParams, "GET", TWITTER.userInfo(), "xxxxx", "xxxxx"));
204204
}
205205

206206
@Test

0 commit comments

Comments
 (0)