Skip to content

Commit

Permalink
Add GHA release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
acogoluegnes committed Sep 28, 2023
1 parent 84ba420 commit ee4e437
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-perf-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
event-type: new_snapshot
client-payload: >-
{"archive_url" : "https://github.com/rabbitmq/rabbitmq-java-tools-binaries-dev/releases/download/${{ env.tag_name }}/perf-test-${{ env.release_version}}.jar",
"tags": "pivotalrabbitmq/perf-test:dev,pivotalrabbitmq/perf-test:dev-${{ env.tag_name }}"}
"tags": "pivotalrabbitmq/perf-test:dev,pivotalrabbitmq/perf-test:dev-${{ env.release_version }}"}
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Release PerfTest

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- name: Evaluate release type
run: ci/evaluate-release.sh
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
server-id: ${{ env.maven_server_id }}
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Release PerfTest (GA)
if: ${{ env.ga_release == 'true' }}
run: |
git config user.name "rabbitmq-ci"
git config user.email "[email protected]"
ci/release-perf-test.sh
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Release PerfTest (Milestone/RC)
if: ${{ env.ga_release != 'true' }}
run: |
git config user.name "rabbitmq-ci"
git config user.email "[email protected]"
ci/release-perf-test.sh
env:
MAVEN_USERNAME: ''
MAVEN_PASSWORD: ${{ secrets.PACKAGECLOUD_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Package Perf Test
run: ci/package-perf-test.sh
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Push to GitHub Release (GA)
uses: softprops/action-gh-release@v1
with:
files: packages/*
name: ${{ env.release_name }}
tag_name: ${{ env.tag_name }}
target_commitish: ${{ env.release_branch }}
prerelease: ${{ env.prerelease }}
token: ${{ secrets.CI_GITHUB_TOKEN }}
repository: rabbitmq/rabbitmq-perf-test
- name: Trigger Perf Test Docker image build (GA)
uses: peter-evans/repository-dispatch@v2
if: ${{ env.ga_release == 'true' }}
with:
event-type: new_snapshot
client-payload: >-
{"archive_url" : "https://github.com/rabbitmq/rabbitmq-perf-test/releases/download/${{ env.tag_name }}/perf-test-${{ env.release_version}}.jar",
"tags": "pivotalrabbitmq/perf-test:latest,pivotalrabbitmq/perf-test:${{ env.release_version }}"}
- name: Trigger Perf Test Docker image build (Milestone/RC)
uses: peter-evans/repository-dispatch@v2
if: ${{ env.ga_release != 'true' }}
with:
event-type: new_snapshot
client-payload: >-
{"archive_url" : "https://github.com/rabbitmq/rabbitmq-perf-test/releases/download/${{ env.tag_name }}/perf-test-${{ env.release_version}}.jar",
"tags": "pivotalrabbitmq/perf-test:${{ env.release_version }}"}
- name: Generate documentation
run: |
rm -rf target/generated-docs
make doc
- name: Publish documentation to GitHub Pages
run: |
git config user.name "rabbitmq-ci"
git config user.email "[email protected]"
ci/publish-documentation-to-github-pages.sh
- name: Prepare worker
if: ${{ env.ga_release == 'true' }}
run: |
mkdir ci/worker/public
cp target/generated-docs/index.html ci/worker/public
- name: Publish documentation to Cloudflare (GA)
uses: cloudflare/[email protected]
if: ${{ env.ga_release == 'true' }}
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: npm i -D @cloudflare/kv-asset-handler
command: deploy --name perftest --route https://perftest.rabbitmq.com/*
workingDirectory: 'ci/worker'
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
event-type: new_snapshot
client-payload: >-
{"archive_url" : "https://github.com/rabbitmq/rabbitmq-java-tools-binaries-dev/releases/download/${{ env.tag_name }}/perf-test-${{ env.release_version}}.jar",
"tags": "pivotalrabbitmq/perf-test:dev,pivotalrabbitmq/perf-test:dev-${{ env.tag_name }}"}
"tags": "pivotalrabbitmq/perf-test:dev,pivotalrabbitmq/perf-test:dev-${{ env.release_version }}"}
- name: Generate documentation
run: |
rm -rf target/generated-docs
Expand All @@ -98,5 +98,5 @@ jobs:
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
preCommands: npm i -D @cloudflare/kv-asset-handler
command: deploy
command: deploy --name perftest-dev --route https://perftest-dev.rabbitmq.com/*
workingDirectory: 'ci/worker'
14 changes: 14 additions & 0 deletions ci/evaluate-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

source ./release-versions.txt

if [[ $RELEASE_VERSION == *[RCM]* ]]
then
echo "prerelease=true" >> $GITHUB_ENV
echo "ga_release=false" >> $GITHUB_ENV
echo "maven_server_id=packagecloud-rabbitmq-maven-milestones" >> $GITHUB_ENV
else
echo "prerelease=false" >> $GITHUB_ENV
echo "ga_release=true" >> $GITHUB_ENV
echo "maven_server_id=ossrh" >> $GITHUB_ENV
fi
31 changes: 22 additions & 9 deletions ci/package-perf-test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/usr/bin/env bash

CURRENT_DATE=$(date --utc '+%Y%m%d-%H%M%S')
RELEASE_VERSION="$(cat pom.xml | grep -oPm1 '(?<=<version>)[^<]+')-$CURRENT_DATE"
FINAL_NAME="rabbitmq-perf-test-$RELEASE_VERSION"
# shellcheck disable=SC2102
if [[ $POM_VERSION == *[SNAPSHOT]* ]]
then
CURRENT_DATE=$(date --utc '+%Y%m%d-%H%M%S')
RELEASE_VERSION="$(cat pom.xml | grep -oPm1 '(?<=<version>)[^<]+')-$CURRENT_DATE"
FINAL_NAME="rabbitmq-perf-test-$RELEASE_VERSION"
SNAPSHOT="true"
else
source ./release-versions.txt
FINAL_NAME="rabbitmq-perf-test-$RELEASE_VERSION"
fi

./mvnw package assembly:single checksum:files gpg:sign -P assemblies -DfinalName=$FINAL_NAME -DskipTests --no-transfer-progress

Expand All @@ -26,9 +34,14 @@ for filename in packages-latest/*; do
mv $filename $filename_without_version
done

echo "release_name=rabbitmq-perf-test-$RELEASE_VERSION" >> $GITHUB_ENV
echo "release_version=$RELEASE_VERSION" >> $GITHUB_ENV
echo "tag_name=v-rabbitmq-perf-test-$RELEASE_VERSION" >> $GITHUB_ENV

BRANCH=$(cat pom.xml | grep -oPm1 "(?<=<version>)[^<]+" | cut --delimiter=. --fields=1,2)
echo "branch=$BRANCH" >> $GITHUB_ENV
if [[ $SNAPSHOT = "true" ]]
then
echo "release_name=$RELEASE_VERSION" >> $GITHUB_ENV
echo "release_version=$RELEASE_VERSION" >> $GITHUB_ENV
echo "tag_name=v-rabbitmq-perf-test-$RELEASE_VERSION" >> $GITHUB_ENV
else
echo "release_name=rabbitmq-perf-test-$RELEASE_VERSION" >> $GITHUB_ENV
echo "release_version=$RELEASE_VERSION" >> $GITHUB_ENV
echo "tag_name=v$RELEASE_VERSION" >> $GITHUB_ENV
echo "release_branch=$RELEASE_BRANCH" >> $GITHUB_ENV
fi
25 changes: 25 additions & 0 deletions ci/release-perf-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

source ./release-versions.txt
git checkout $RELEASE_BRANCH

./mvnw release:clean release:prepare -DdryRun=true -Darguments="-DskipTests" --no-transfer-progress \
--batch-mode -Dtag="v$RELEASE_VERSION" \
-DreleaseVersion=$RELEASE_VERSION \
-DdevelopmentVersion=$DEVELOPMENT_VERSION \

./mvnw release:clean release:prepare -Darguments="-DskipTests" --no-transfer-progress \
--batch-mode -Dtag="v$RELEASE_VERSION" \
-DreleaseVersion=$RELEASE_VERSION \
-DdevelopmentVersion=$DEVELOPMENT_VERSION

git checkout "v$RELEASE_VERSION"

if [[ $RELEASE_VERSION == *[RCM]* ]]
then
MAVEN_PROFILE="milestone"
else
MAVEN_PROFILE="release"
fi

./mvnw clean deploy -P $MAVEN_PROFILE -DskipTests --no-transfer-progress
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<scm>
<url>https://github.com/rabbitmq/rabbitmq-perf-test</url>
<connection>scm:git:git://github.com/rabbitmq/rabbitmq-perf-test.git</connection>
<developerConnection>scm:git:git@github.com:rabbitmq/rabbitmq-perf-test.git</developerConnection>
<developerConnection>scm:git:https://github.com/rabbitmq/rabbitmq-perf-test.git</developerConnection>
<tag>HEAD</tag>
</scm>

Expand Down

0 comments on commit ee4e437

Please sign in to comment.