Skip to content

Commit efba2d7

Browse files
committed
update workflows for auto versioning [skip ci]
1 parent a246f6e commit efba2d7

File tree

4 files changed

+77
-14
lines changed

4 files changed

+77
-14
lines changed

.github/workflows/release_build.yml

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ on:
1818
jobs:
1919
release:
2020
runs-on: ubuntu-latest
21+
outputs:
22+
taskit_version: ${{ steps.version-string.outputs.taskit_version }}
2123
permissions:
2224
contents: write
2325
steps:
@@ -42,10 +44,12 @@ jobs:
4244
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
4345
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
4446

45-
- name: Get Taskit Version
47+
- name: Get Version
48+
id: version-string
4649
run: |
4750
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV"
48-
51+
echo "taskit_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_OUTPUT"
52+
4953
- name: Make Taskit Release
5054
uses: ncipollo/[email protected]
5155
with:
@@ -54,3 +58,51 @@ jobs:
5458
tag: "v${{ env.version }}"
5559
generateReleaseNotes: true
5660
skipIfReleaseExists: true
61+
62+
update-gcm-taskit:
63+
needs: release
64+
runs-on: ubuntu-latest
65+
permissions:
66+
contents: write
67+
env:
68+
VERSION: ${{ needs.release.outputs.gcm_taskit_version }}
69+
steps:
70+
- name: Checkout GCM Taskit
71+
uses: actions/checkout@v4
72+
with:
73+
repository: HHS/ASPR-ms-gcm-taskit
74+
token: ${{ secrets.GHA_BOT }}
75+
76+
- name: Update Taskit version
77+
run : |
78+
echo "$VERSION"
79+
sed -i "0,/<taskit.version>.*<\/taskit.version>/s//<taskit.version>$VERSION<\/taskit.version>/g" pom.xml
80+
81+
- name: Increment GCM Taskit Version
82+
run: |
83+
current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml)
84+
echo GCM Taskit Version: $current_version
85+
parts=( ${current_version//./ } )
86+
bv=$((parts[2] + 1))
87+
new_version="${parts[0]}.${parts[1]}.${bv}"
88+
echo New GCM Taskit Version: $new_version
89+
sed -i "0,/<revision>.*<\/revision>/s//<revision>$new_version<\/revision>/g" pom.xml
90+
91+
- name: Setup Git
92+
run: |
93+
git config --global user.name "github-actions"
94+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
95+
96+
- name: Make branch in GCM Taskit
97+
run: |
98+
git checkout -b update-gcm-taskit-to-$VERSION
99+
git add pom.xml
100+
git commit -m "Update gcm taskit to $VERSION"
101+
git push --set-upstream origin update-gcm-taskit-to-$VERSION
102+
103+
- name: Make PR in GCM Taskit
104+
run: |
105+
gh pr create -R HHS/ASPR-ms-gcm-taskit -B main --fill
106+
gh pr merge -m --auto
107+
env:
108+
GH_TOKEN: ${{ secrets.GHA_BOT }}

core/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,13 @@
2626
<url>https://github.com/HHS/aspr-ms-taskit/tree/main/core</url>
2727
</scm>
2828

29+
<build>
30+
<plugins>
31+
<plugin>
32+
<groupId>org.sonatype.central</groupId>
33+
<artifactId>central-publishing-maven-plugin</artifactId>
34+
</plugin>
35+
</plugins>
36+
</build>
37+
2938
</project>

pom.xml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@
194194
<groupId>org.sonatype.central</groupId>
195195
<artifactId>central-publishing-maven-plugin</artifactId>
196196
<version>${central-publishing-maven-plugin.version}</version>
197+
<extensions>true</extensions>
198+
<configuration>
199+
<publishingServerId>central</publishingServerId>
200+
<tokenAuth>true</tokenAuth>
201+
<deploymentName>ASPR MS Taskit</deploymentName>
202+
<autoPublish>true</autoPublish>
203+
<waitUntil>published</waitUntil>
204+
</configuration>
197205
</plugin>
198206
</plugins>
199207

@@ -273,17 +281,6 @@
273281
</configuration>
274282
<inherited>false</inherited>
275283
</plugin>
276-
277-
<plugin>
278-
<groupId>org.sonatype.central</groupId>
279-
<artifactId>central-publishing-maven-plugin</artifactId>
280-
<extensions>true</extensions>
281-
<configuration>
282-
<publishingServerId>central</publishingServerId>
283-
<tokenAuth>true</tokenAuth>
284-
<deploymentName>ASPR MS Taskit</deploymentName>
285-
</configuration>
286-
</plugin>
287284
</plugins>
288285
</build>
289286

protobuf/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<name>Translation and Serialization Toolkit (Taskit): Protobuf</name>
1919
<description>A toolkit that aids in the conversion between Protobuf Java objects and application Java objects.</description>
2020
<url>https://github.com/HHS/aspr-ms-taskit</url>
21-
21+
2222
<!-- SCM Information -->
2323
<scm>
2424
<connection>scm:git:git://github.com/HHS/aspr-ms-taskit.git</connection>
@@ -175,6 +175,11 @@
175175
</configuration>
176176
</plugin>
177177

178+
<plugin>
179+
<groupId>org.sonatype.central</groupId>
180+
<artifactId>central-publishing-maven-plugin</artifactId>
181+
</plugin>
182+
178183
</plugins>
179184
</build>
180185

0 commit comments

Comments
 (0)