-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated maven-release.yml * Updated maven-release.yml permissions * Updated maven-deploy.yml * Updated maven-deploy.yml: perform section updated * Skip reactor deployment * Setup tmate SSH session * Factorized steps in maven-deploy.yaml * Fixed maven-release.yaml * Added SSH session on maven-release.yml * SSH session on maven-release.yml only in the last job * Fixed GitHub Pages release workflow * Fixed GitHub Pages release workflow [maven-release-plugin] prepare release v1.0.00 * Testing * Testing: Fixed pom.xml * Testing 1 * Testing 2 * Testing 3 * Testing 4 * Testing 5 * Testing 6 * Testing 7 * Testing 8 * Testing 9 * Testing 10 * Testing 10 * Testing 11 * Testing 12 * Testing 12 * Testing 13 * Fix 13 * Test 14 * Test15 * Test 16 * Test 17 * Test 18 * Test 19 * Test 19 * Test 20 * Test 21 * Test 22 * Test 23 * Test 23 SSH * Fix and SSH * Fix and SSH 2 * Finalize 1 * Finalize 2 * Finalize 3
- Loading branch information
Showing
5 changed files
with
93 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,24 @@ on: | |
push: | ||
branches: [ "main" ] | ||
|
||
# Default to bash | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
deploy: | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest ] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
@@ -29,36 +39,12 @@ jobs: | |
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
|
||
- name: Build and Deploy from ubuntu-latest | ||
run: mvn -B deploy | ||
- name: Build and Deploy from ${{ matrix.os }} | ||
run: mvn -B deploy --file pom.xml -s $GITHUB_WORKSPACE/settings.xml | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
# Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive | ||
- name: Maven Dependency Tree Dependency Submission | ||
uses: advanced-security/[email protected] | ||
|
||
build-windows: | ||
runs-on: windows-latest | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
|
||
- name: Build and Deploy from windows-latest | ||
run: mvn -B deploy | ||
env: | ||
GITHUB_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 |
---|---|---|
|
@@ -33,6 +33,7 @@ permissions: | |
pull-requests: write | ||
pages: write | ||
id-token: write | ||
packages: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these releases and deployments to complete. | ||
|
@@ -90,33 +91,47 @@ jobs: | |
git tag -d ${{ env.tagName }} || true | ||
git push origin :refs/tags/${{ env.tagName }} || true | ||
- name: Prepare release | ||
id: prepare | ||
- name: Update project version to ${{ inputs.releaseVersion }} | ||
run: | | ||
mvn -B -U \ | ||
release:clean \ | ||
release:prepare \ | ||
-DpreparationGoals="clean verify" \ | ||
-DreleaseVersion=${{ inputs.releaseVersion }} \ | ||
-DdevelopmentVersion=${{ inputs.developmentVersion }} \ | ||
-Dresume=false | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
mvn versions:set -DnewVersion=${{ inputs.releaseVersion }} | ||
mvn versions:commit | ||
- name: Release rollback on failure | ||
- name: Commit ${{ inputs.releaseVersion }} | ||
run: | | ||
mvn -B -U \ | ||
release:rollback \ | ||
if: always() && (steps.prepare.outcome == 'failure') | ||
git add pom.xml metricshub-jre-linux/pom.xml metricshub-jre-windows/pom.xml | ||
git commit -m "Updated POM version to ${{ inputs.releaseVersion }}" | ||
- name: Create tag ${{ env.tagName }} | ||
run: | | ||
git tag -a ${{ env.tagName }} -m "Release ${{ env.tagName }}" | ||
- name: Push tag ${{ env.tagName }} | ||
run: | | ||
git push origin ${{ env.tagName }} | ||
- name: Prepare next version ${{ inputs.developmentVersion }} | ||
run: | | ||
mvn versions:set -DnewVersion=${{ inputs.developmentVersion }} | ||
mvn versions:commit | ||
git add pom.xml metricshub-jre-linux/pom.xml metricshub-jre-windows/pom.xml | ||
git commit -m "Updated POM version to ${{ inputs.developmentVersion }}" | ||
- name: Push next version ${{ inputs.developmentVersion }}" | ||
run: | | ||
git push origin ${{ env.branchName }} | ||
release: | ||
name: Release v${{ inputs.releaseVersion }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
name: Release v${{ inputs.releaseVersion }} on ${{ matrix.config.os }} | ||
|
||
needs: prepare | ||
|
||
runs-on: ${{ matrix.config.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest ] | ||
config: | ||
- { os: ubuntu-latest, packageSuffix: linux } | ||
- { os: windows-latest, packageSuffix: windows } | ||
|
||
steps: | ||
|
||
|
@@ -132,30 +147,48 @@ jobs: | |
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
|
||
- name: Checkout ${{ needs.prepare.outputs.tagName }} branch | ||
run: | | ||
git fetch | ||
git checkout ${{ needs.prepare.outputs.tagName }} 2>/dev/null | ||
- name: Perform release to GitHub Packages | ||
id: perform | ||
run: | | ||
mvn -B -U \ | ||
release:perform \ | ||
-Dgoals=deploy \ | ||
-DworkingDirectory=$GITHUB_WORKSPACE/target/release \ | ||
-DreleaseVersion=${{ inputs.releaseVersion }} \ | ||
-DdevelopmentVersion=${{ inputs.developmentVersion }} \ | ||
clean deploy \ | ||
-s $GITHUB_WORKSPACE/settings.xml | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: Release rollback on failure | ||
- name: Get Deployed Package Version ID from Versions | ||
id: version-id | ||
run: | | ||
mvn -B -U \ | ||
release:rollback \ | ||
curl -X GET -H "Authorization: Bearer ${{env.GITHUB_TOKEN}}" https://api.github.com/orgs/sentrysoftware/packages/maven/org.sentrysoftware.metricshub-jre-${{ matrix.config.packageSuffix }}/versions >> $HOME/versionIds.json | ||
echo "versionId=$(grep -B1 '"name": "${{ inputs.releaseVersion }}"' $HOME/versionIds.json | grep '"id":' | awk -F': ' '{print $2}' | tr -d ',')" >> $GITHUB_ENV | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
if: always() && (steps.perform.outcome == 'failure') | ||
|
||
- name: Deployed Version ID | ||
run: echo "The deployed Version ID is ${{ env.versionId }}" | ||
if: always() && (steps.perform.outcome == 'failure') | ||
|
||
- name: Package ${{ inputs.releaseVersion }} removal on failure | ||
uses: actions/delete-package-versions@v4 | ||
with: | ||
package-version-ids: ${{ env.versionId }} | ||
package-name: org.sentrysoftware.metricshub-jre-${{ matrix.config.packageSuffix }} | ||
package-type: maven | ||
if: always() && (steps.perform.outcome == 'failure') && (env.versionId != '') | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: jre-${{ matrix.os }} | ||
name: jre-${{ matrix.config.os }} | ||
path: | | ||
./target/release/target/*.buildinfo | ||
./metricshub-jre-*/target/release/target/*.zip | ||
./target/*.buildinfo | ||
./metricshub-jre-*/target/*.zip | ||
./metricshub-jre-*/target/*.buildinfo | ||
# Finalize job | ||
finalize: | ||
|
@@ -164,6 +197,8 @@ jobs: | |
needs: [ prepare, release ] | ||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
merge-multiple: true | ||
|
@@ -175,8 +210,9 @@ jobs: | |
fail_on_unmatched_files: false | ||
generate_release_notes: true | ||
files: | | ||
*.buildinfo | ||
*.zip | ||
./target/*.buildinfo | ||
./metricshub-jre-*/target/*.zip | ||
./metricshub-jre-*/target/*.buildinfo | ||
- name: Create Pull Request from ${{ needs.prepare.outputs.branchName }} to ${{ github.event.repository.default_branch }} | ||
uses: devops-infra/[email protected] | ||
|
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