Skip to content

Commit

Permalink
Dagrieve/pipelines (#402)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
dsgrieve and aalmiray authored Nov 21, 2024
1 parent c86cfcf commit d704022
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .devops/scripts/github-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ previous_release_version=$( \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/microsoft/gctoolkit/releases/latest | grep 'tag_name' \
)
previous_release_version=$( perl -pe 's/"tag_name":\s+"(.*?)",?/$1/' <<< $previous_release_version )
previous_release_version=$( perl -pe 's/"tag_name":\s+"(.*?)",?/$1/' <<< "${previous_release_version}" )

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

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

58 changes: 58 additions & 0 deletions .github/workflows/release_to_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release to GitHub

on:
workflow_dispatch:

jobs:
release:

runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: main
fetch-depth: 0

- name: Cache Maven
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Setup Java JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
java-version: '11'
distribution: 'microsoft'

- name: Version
id: version
run: |
release_version=$( ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout )
release_version=${release_version%-*}
echo "version=${release_version}" >> "$GITHUB_ENV"
# Get the previous release version from what is actually on GitHub
previous_release_version=$( ./mvnw help:evaluate -Dexpression=project.scm.tag -q -DforceStdout )
echo "previous_version=${previous_release_version}" >> "$GITHUB_ENV"
- name: Release Prepare
run: |
./mvnw -B -Prelease release:clean release:prepare \
-Drepository.url=https://${{ github.actor }}:${{ secrets.RELEASE_TOKEN }}@github.com/${{ github.repository }}.git
env:
GIT_AUTHOR_NAME: 'Git'
GIT_AUTHOR_EMAIL: 'noreply@github.com'
GIT_COMMITTER_NAME: 'Git'
GIT_COMMITTER_EMAIL: 'noreply@github.com'

- name: Release to GitHub
run: |
./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release \
-Djreleaser.previous.tag.name="$previous_version" \
-Djreleaser.tag.name="$version"
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 18 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven.release-plugin.version}</version>
<configuration>
<releaseProfiles>release</releaseProfiles>
<projectVersionPolicyId>SemVerVersionPolicy</projectVersionPolicyId>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -432,19 +441,6 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<skip>true</skip>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<excludes>
<exclude>gclogs/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -521,6 +517,15 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<tagNameFormat>gctoolkit-${project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<preparationGoals>clean site</preparationGoals>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down

0 comments on commit d704022

Please sign in to comment.