Skip to content

Commit d704022

Browse files
dsgrieveaalmiray
andauthored
Dagrieve/pipelines (#402)
* fix java install * try out a cron job * jreleaser.yml action * update release scripts * error in tag name parameter * changelog tweaks * Fix issue with dependabot changes in changelog. Co-authored-by: Andres Almiray <aalmiray@gmail.com> * cleanup github-release script * set contenttype in gctoolkit release pipeline to Maven * release_to_github.yml updates --------- Co-authored-by: Andres Almiray <aalmiray@gmail.com>
1 parent c86cfcf commit d704022

File tree

3 files changed

+79
-16
lines changed

3 files changed

+79
-16
lines changed

.devops/scripts/github-release.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ previous_release_version=$( \
1212
-H "Accept: application/vnd.github+json" \
1313
https://api.github.com/repos/microsoft/gctoolkit/releases/latest | grep 'tag_name' \
1414
)
15-
previous_release_version=$( perl -pe 's/"tag_name":\s+"(.*?)",?/$1/' <<< $previous_release_version )
15+
previous_release_version=$( perl -pe 's/"tag_name":\s+"(.*?)",?/$1/' <<< "${previous_release_version}" )
1616

1717
release_version=$( git tag --sort=-taggerdate --list | head -n 1 )
1818

1919
./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release \
20-
-Djreleaser.previous.tag.name=${previous_release_version} \
21-
-Djreleaser.tag.name=${release_version}
20+
-Djreleaser.previous.tag.name="${previous_release_version}" \
21+
-Djreleaser.tag.name="${release_version}"
2222

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release to GitHub
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout project
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
with:
15+
ref: main
16+
fetch-depth: 0
17+
18+
- name: Cache Maven
19+
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
20+
with:
21+
path: ~/.m2/repository
22+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
23+
restore-keys: ${{ runner.os }}-m2
24+
25+
- name: Setup Java JDK
26+
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
27+
with:
28+
java-version: '11'
29+
distribution: 'microsoft'
30+
31+
- name: Version
32+
id: version
33+
run: |
34+
release_version=$( ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout )
35+
release_version=${release_version%-*}
36+
echo "version=${release_version}" >> "$GITHUB_ENV"
37+
38+
# Get the previous release version from what is actually on GitHub
39+
previous_release_version=$( ./mvnw help:evaluate -Dexpression=project.scm.tag -q -DforceStdout )
40+
echo "previous_version=${previous_release_version}" >> "$GITHUB_ENV"
41+
42+
- name: Release Prepare
43+
run: |
44+
./mvnw -B -Prelease release:clean release:prepare \
45+
-Drepository.url=https://${{ github.actor }}:${{ secrets.RELEASE_TOKEN }}@github.com/${{ github.repository }}.git
46+
env:
47+
GIT_AUTHOR_NAME: 'Git'
48+
GIT_AUTHOR_EMAIL: 'noreply@github.com'
49+
GIT_COMMITTER_NAME: 'Git'
50+
GIT_COMMITTER_EMAIL: 'noreply@github.com'
51+
52+
- name: Release to GitHub
53+
run: |
54+
./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release \
55+
-Djreleaser.previous.tag.name="$previous_version" \
56+
-Djreleaser.tag.name="$version"
57+
env:
58+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

+18-13
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,15 @@
277277
</dependency>
278278
</dependencies>
279279
</plugin>
280+
<plugin>
281+
<groupId>org.apache.maven.plugins</groupId>
282+
<artifactId>maven-release-plugin</artifactId>
283+
<version>${maven.release-plugin.version}</version>
284+
<configuration>
285+
<releaseProfiles>release</releaseProfiles>
286+
<projectVersionPolicyId>SemVerVersionPolicy</projectVersionPolicyId>
287+
</configuration>
288+
</plugin>
280289
<plugin>
281290
<groupId>org.apache.maven.plugins</groupId>
282291
<artifactId>maven-surefire-plugin</artifactId>
@@ -432,19 +441,6 @@
432441
<artifactId>apache-rat-plugin</artifactId>
433442
<configuration>
434443
<skip>true</skip>
435-
<executions>
436-
<execution>
437-
<phase>validate</phase>
438-
<goals>
439-
<goal>check</goal>
440-
</goals>
441-
<configuration>
442-
<excludes>
443-
<exclude>gclogs/**</exclude>
444-
</excludes>
445-
</configuration>
446-
</execution>
447-
</executions>
448444
</configuration>
449445
</plugin>
450446
<plugin>
@@ -521,6 +517,15 @@
521517
</execution>
522518
</executions>
523519
</plugin>
520+
<plugin>
521+
<groupId>org.apache.maven.plugins</groupId>
522+
<artifactId>maven-release-plugin</artifactId>
523+
<configuration>
524+
<tagNameFormat>gctoolkit-${project.version}</tagNameFormat>
525+
<autoVersionSubmodules>true</autoVersionSubmodules>
526+
<preparationGoals>clean site</preparationGoals>
527+
</configuration>
528+
</plugin>
524529
</plugins>
525530
</build>
526531
</profile>

0 commit comments

Comments
 (0)