Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release scripts and updates to pom #401

Merged
merged 9 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .devops/gctoolkit-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
trigger: none
pr: none

variables:
JAVA_HOME_11_X64: /usr/lib/jvm/msopenjdk-11

resources:
repositories:
- repository: 1esPipelines
Expand Down Expand Up @@ -46,6 +49,8 @@ extends:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
env:
JAVA_HOME_11_X64: $(JAVA_HOME_11_X64)
displayName: 'Set Java to v11'

# download signing keys from Azure Key Vault
Expand Down Expand Up @@ -181,8 +186,7 @@ extends:
clientid: '516af6d8-6ab4-4069-8f64-b18c64d16688'
intent: 'PackageDistribution'
# Test with contentype PyPI to avoid publishing to Maven Central
# contenttype: 'Maven'
contenttype: 'PyPI'
contenttype: 'Maven'
contentsource: 'Folder'
folderlocation: '$(Build.ArtifactStagingDirectory)/staging'
waitforreleasecompletion: true
Expand Down
71 changes: 0 additions & 71 deletions .devops/pre-merge-checks.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .devops/scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -euxo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PROJECT_HOME=$SCRIPT_DIR/../..

cd $PROJECT_HOME

GIT_AUTHOR_NAME='Git' \
GIT_AUTHOR_EMAIL='noreply@github.com' \
GIT_COMMITTER_NAME='Git' \
GIT_COMMITTER_EMAIL='noreply@github.com' \
./mvnw -B -DskipTests clean release:clean release:prepare -Prelease -DpushChanges=false
22 changes: 22 additions & 0 deletions .devops/scripts/github-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -euxo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PROJECT_HOME=$SCRIPT_DIR/../..

cd $PROJECT_HOME

previous_release_version=$( \
curl --location --silent \
-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 )

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}

39 changes: 39 additions & 0 deletions .devops/weekly-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

trigger: none

schedules:
- cron: 0 0 * * 0
displayName: "Weekly build"
branches:
include: [ main ]
always: true

variables:
JAVA_HOME_11_X64: /usr/lib/jvm/msopenjdk-11

pool:
name: JEG-mariner2.0-x64-release

steps:
- task: JavaToolInstaller@0
inputs:
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
env:
JAVA_HOME_11_X64: $(JAVA_HOME_11_X64)
displayName: 'Set Java to v11'

- checkout: self
clean: true

- task: Maven@4
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean package'
options: '-B -Prelease'
mavenOptions: '-s $(Build.SourcesDirectory)/.devops/feed-settings.xml'
mavenAuthenticateFeed: true
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
displayName: 'Build with Maven'
53 changes: 53 additions & 0 deletions .github/workflows/jreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release to GitHub using JReleaser

on:
workflow_dispatch:

jobs:
publish:

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'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN

- name: Configure Git user
run: |
git config user.email "noreply@github.com"
git config user.name "GitHub"
git config committer.name "GitHub"
git config committer.email "noreply@github.com"

- name: Version
id: version
run: |
release_version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
release_version=${release_version%-*}
echo ::set-output name=version::${release_version}

- name: Git-release
run: |
./mvnw -B versions:set -DnewVersion=${{steps.version.outputs.version}}
./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 27 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<properties>
<revision>3.0.3-SNAPSHOT</revision>
<checkstyle.version>10.18.2</checkstyle.version>
<jreleaser.plugin.version>1.14.0</jreleaser.plugin.version>
<jreleaser.plugin.version>1.15.0</jreleaser.plugin.version>
<junit5.version>5.11.1</junit5.version>
<maven.antrun-plugin.version>3.1.0</maven.antrun-plugin.version>
<maven.changes-plugin.version>2.12.1</maven.changes-plugin.version>
Expand Down Expand Up @@ -541,25 +541,44 @@
<skipTag>true</skipTag>
<changelog>
<formatted>ALWAYS</formatted>
<preset>conventional-commits</preset>
<labelers>
<labeler>
<label>maven-release</label>
<title>[maven-release-plugin]</title>
</labeler>
<labeler>
<label>bots</label>
<contributor>dependabot[bot]</contributor>
</labeler>
<labeler>
<label>not-github-issue</label>
<title>regex:.*(?!#\\d+).*</title>
</labeler>
<labeler>
<label>github-issue</label>
<title>#</title>
</labeler>
</labelers>
<categories>
<category>
<title>bots</title>
<labels>bots</labels>
<order>1</order>
</category>
<category>
<title>maven-release</title>
<labels>maven-release</labels>
<order>2</order>
</category>
<category>
<title>not-github-issue</title>
<labels>not-github-issue</labels>
<order>4</order>
</category>
<category>
<title>♻️ Changes</title>
<labels>github-issue</labels>
<order>3</order>
</category>
</categories>
<contributors>
Expand All @@ -569,10 +588,14 @@
</contributors>
<hide>
<contributors>
GitHub
<contributor>GitHub</contributor>
<contributor>Git</contributor>
<contributor>dependabot[bot]</contributor>
</contributors>
<categories>
maven-release
<category>maven-release</category>
<category>bots</category>
<category>not-github-issue</category>
</categories>
</hide>
</changelog>
Expand Down