-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add release workflow * Fix version * Create github release * Skip branch condition for testing * Add shellcheck * Fix token for gh release * Deploy to maven central * Finish release workflow * Update dependencies * Describe new release process * Update release notes * Mark variables as read-only * Implement review findings * Implement review findings * Update release date --------- Co-authored-by: kaklakariada <[email protected]>
- Loading branch information
1 parent
c6af4ab
commit 8c2c443
Showing
9 changed files
with
131 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
base_dir="$( cd "$(dirname "$0")/../.." >/dev/null 2>&1 ; pwd -P )" | ||
readonly base_dir | ||
readonly pom_file="$base_dir/parent/pom.xml" | ||
|
||
# Read project version from pom file | ||
project_version=$(grep "<revision>" "$pom_file" | sed --regexp-extended 's/\s*<revision>(.*)<\/revision>\s*/\1/g') | ||
readonly project_version | ||
echo "Read project version '$project_version' from $pom_file" | ||
|
||
# Calculate checksum | ||
readonly artifact_path="$base_dir/product/target/openfasttrace-${project_version}.jar" | ||
echo "Calculate sha256sum for file '$artifact_path'" | ||
file_dir="$(dirname "$artifact_path")" | ||
readonly file_dir | ||
file_name=$(basename "$artifact_path") | ||
readonly file_name | ||
cd "$file_dir" | ||
readonly checksum_file_name="${file_name}.sha256" | ||
sha256sum "$file_name" > "$checksum_file_name" | ||
readonly checksum_file_path="$file_dir/$checksum_file_name" | ||
cd "$base_dir" | ||
|
||
|
||
# Create GitHub release | ||
readonly changes_file="$base_dir/doc/changes/changes_${project_version}.md" | ||
notes=$(cat "$changes_file") | ||
readonly notes | ||
|
||
readonly title="Release $project_version" | ||
readonly tag="$project_version" | ||
echo "Creating release:" | ||
echo "Git tag : $tag" | ||
echo "Title : $title" | ||
echo "Changes file : $changes_file" | ||
echo "Artifact file: $artifact_path" | ||
echo "Checksum file: $checksum_file_path" | ||
|
||
release_url=$(gh release create --latest --title "$title" --notes "$notes" --target main "$tag" "$artifact_path" "$checksum_file_path") | ||
readonly release_url | ||
echo "Release URL: $release_url" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,63 @@ | ||
name: Release on Maven Central and GitHub | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
deploy-maven-central: | ||
description: "Deploy to Maven Central" | ||
skip-deploy-maven-central: | ||
description: "Skip deployment to Maven Central" | ||
required: true | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: "bash" | ||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
permissions: | ||
contents: write # Required for creating GitHub release | ||
steps: | ||
- run: echo "Dummy workflow for testing" | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Fail if not running on main branch | ||
if: ${{ github.ref != 'refs/heads/main' }} | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') | ||
- name: Set up Maven Central Repository | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "temurin" | ||
java-version: 17 | ||
cache: "maven" | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
|
||
- name: Build | ||
run: mvn --batch-mode -T 1C clean install | ||
|
||
- name: List secret GPG keys | ||
run: gpg --list-secret-keys | ||
|
||
- name: Publish to Maven Central Repository | ||
if: ${{ !inputs.skip-deploy-maven-central }} | ||
run: mvn --batch-mode deploy -Possrh -DstagingDescription="Deployed via GitHub workflow release.yml" | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} | ||
|
||
- name: Create GitHub Release | ||
run: ./.github/workflows/github_release.sh | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
base_dir="$( cd "$(dirname "$0")/../.." >/dev/null 2>&1 ; pwd -P )" | ||
|
||
shellcheck --enable=all --severity=warning --check-sourced --color=auto \ | ||
"$base_dir/.github/workflows/run_shellcheck.sh" \ | ||
"$base_dir/.github/workflows/github_release.sh" \ | ||
"$base_dir/oft" \ | ||
"$base_dir/oft-self-trace.sh" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"vscjava.vscode-java-pack" | ||
"vscjava.vscode-java-pack", | ||
"sonarsource.sonarlint-vscode", | ||
"timonwong.shellcheck" | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters