Skip to content

Commit d31c1e2

Browse files
authored
Add release workflow (#34)
Closes #9 --------- Signed-off-by: Edoardo Vacchi <[email protected]>
1 parent 26c6ce7 commit d31c1e2

File tree

2 files changed

+103
-44
lines changed

2 files changed

+103
-44
lines changed

Diff for: .github/workflows/release.yaml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-version:
7+
description: 'Version being released'
8+
required: true
9+
branch:
10+
description: 'Branch to release from'
11+
required: true
12+
default: 'main'
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
release:
19+
name: Release
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Install libextism
27+
uses: ./.github/actions/libextism
28+
29+
- name: Setup Java
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: 21
33+
distribution: 'temurin'
34+
server-id: ossrh
35+
server-username: MAVEN_USERNAME
36+
server-password: MAVEN_PASSWORD
37+
gpg-private-key: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
38+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
39+
40+
- id: install-secret-key
41+
name: Install gpg secret key
42+
run: |
43+
cat <(echo -e "${{ secrets.JRELEASER_GPG_SECRET_KEY }}") | gpg --batch --import
44+
gpg --list-secret-keys --keyid-format LONG
45+
46+
- name: Compile
47+
run: mvn --batch-mode --no-transfer-progress verify
48+
49+
- name: Setup Git
50+
run: |
51+
git config user.name "Extism BOT"
52+
git config user.email "[email protected]"
53+
54+
- name: Set the version
55+
run: |
56+
mvn --batch-mode --no-transfer-progress versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.release-version }}
57+
env:
58+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
59+
60+
- name: Release to Maven Central
61+
run: |
62+
mvn --batch-mode --no-transfer-progress -Prelease clean verify deploy -X
63+
env:
64+
MAVEN_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }}
65+
MAVEN_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }}
66+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
67+
68+
- name: Commit tag, back to Snapshot and Push
69+
if: ${{ ! endsWith(github.event.inputs.release-version, '-SNAPSHOT') }}
70+
run: |
71+
git add .
72+
git commit -m "Release version update ${{ github.event.inputs.release-version }}"
73+
git tag ${{ github.event.inputs.release-version }}
74+
mvn --batch-mode --no-transfer-progress versions:set -DgenerateBackupPoms=false -DnewVersion=999-SNAPSHOT
75+
git add .
76+
git commit -m "Snapshot version update"
77+
git push
78+
git push origin ${{ github.event.inputs.release-version }}
79+
env:
80+
GITHUB_TOKEN: ${{ github.token }}

Diff for: pom.xml

+23-44
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>org.extism.sdk</groupId>
66
<artifactId>extism</artifactId>
77
<packaging>jar</packaging>
8-
<version>1.1.0</version>
8+
<version>999-SNAPSHOT</version>
99
<name>extism</name>
1010
<url>https://github.com/extism/extism</url>
1111
<description>Java-SDK for Extism to use webassembly from Java</description>
@@ -43,9 +43,17 @@
4343

4444
<issueManagement>
4545
<system>Github</system>
46-
<url>https://github.com/extism/extism/issues</url>
46+
<url>https://github.com/extism/java-sdk/issues</url>
4747
</issueManagement>
4848

49+
<distributionManagement>
50+
<repository>
51+
<id>ossrh</id>
52+
<name>Central Repository OSSRH</name>
53+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
54+
</repository>
55+
</distributionManagement>
56+
4957
<properties>
5058
<java.version>11</java.version>
5159
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -62,13 +70,18 @@
6270
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
6371
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
6472

65-
<!-- jreleaser -->
66-
<jreleaser.git.root.search>true</jreleaser.git.root.search>
6773
</properties>
6874

6975
<profiles>
7076
<profile>
7177
<id>release</id>
78+
<distributionManagement>
79+
<snapshotRepository>
80+
<id>ossrh</id>
81+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
82+
</snapshotRepository>
83+
</distributionManagement>
84+
7285
<build>
7386
<plugins>
7487
<plugin>
@@ -115,54 +128,20 @@
115128
</executions>
116129
</plugin>
117130
<plugin>
118-
<groupId>org.jreleaser</groupId>
119-
<artifactId>jreleaser-maven-plugin</artifactId>
120-
<version>1.3.1</version>
131+
<groupId>org.sonatype.plugins</groupId>
132+
<artifactId>nexus-staging-maven-plugin</artifactId>
133+
<extensions>true</extensions>
121134
<configuration>
122-
<jreleaser>
123-
<release>
124-
<github>
125-
<skipRelease>true</skipRelease>
126-
</github>
127-
</release>
128-
<signing>
129-
<active>ALWAYS</active>
130-
<armored>true</armored>
131-
</signing>
132-
<deploy>
133-
<maven>
134-
<nexus2>
135-
<maven-central>
136-
<active>ALWAYS</active>
137-
<url>https://s01.oss.sonatype.org/service/local</url>
138-
<!--
139-
<closeRepository>false</closeRepository>
140-
<releaseRepository>false</releaseRepository>
141-
-->
142-
<stagingRepositories>target/staging-deploy</stagingRepositories>
143-
</maven-central>
144-
</nexus2>
145-
</maven>
146-
</deploy>
147-
</jreleaser>
135+
<serverId>ossrh</serverId>
136+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
137+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
148138
</configuration>
149139
</plugin>
150140
</plugins>
151141
</build>
152142
</profile>
153143
</profiles>
154144

155-
<distributionManagement>
156-
<snapshotRepository>
157-
<id>ossrh</id>
158-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
159-
</snapshotRepository>
160-
<repository>
161-
<id>ossrh</id>
162-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
163-
</repository>
164-
</distributionManagement>
165-
166145
<build>
167146
<plugins>
168147
<plugin>

0 commit comments

Comments
 (0)