From 62de285171d8a1a495d3e685f7a331cb2b46ff45 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 10 May 2024 15:05:19 +0200 Subject: [PATCH 01/24] Add mac os signing of mac os --- .github/workflows/pull_request_check.yml | 49 ++++++++++++++++++++++++ .github/workflows/tagged_release.yml | 1 - .jenkins/Jenkinsfile | 46 +++++++++++++++++++--- 3 files changed, 89 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index eec5f4ec..067955ce 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -113,3 +113,52 @@ jobs: with: name: ame-backend-${{ matrix.os }} path: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac + + release: + needs: build + runs-on: ubuntu-latest + steps: + # Sign (Windows & Mac) executable + - name: Get Artifact ID (Windows & Mac) + shell: bash + run: | + # Get the list of artifacts for the specified workflow run + response=$(curl -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/${{ github.repository_owner }}/$(echo '${{ github.repository }}' | cut -d'/' -f2)/actions/runs/${{ github.run_id }}/artifacts") + + # Filter out the ID of the artifact with a name that contains "mac" + artifact_id_mac=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("mac")) | .id') + artifact_id_win=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("win")) | .id') + + # Save the artifact ID in an environment variable + echo "ARTIFACT_ID_MAC=$artifact_id_mac" >> $GITHUB_ENV + echo "ARTIFACT_ID_WIN=$artifact_id_win" >> $GITHUB_ENV + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Commit Artifact url and version changes and push to pre release branch for jenkins (Windows & Mac) + shell: bash + run: | + ARTIFACT_URL_WIN="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID_WIN/zip" + ARTIFACT_URL_MAC="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID_MAC/zip" + BRANCH_NAME="pre_release_configuration" + + echo "artifact_url_win=$ARTIFACT_URL_WIN" > parameters.txt + echo "artifact_url_mac=$ARTIFACT_URL_MAC" > parameters.txt + echo "version=${{ github.event.inputs.release_version }}" >> parameters.txt + + git config --global user.email "github-actions@github.com" + git config --global user.name "github-actions" + git checkout -b $BRANCH_NAME + git add parameters.txt + git commit -m "Add parameters.txt with artifact_url_win, artifact_url_mac and version" + git push origin $BRANCH_NAME + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Trigger Jenkins Job, for signing executable + shell: bash + run: | + DATA='{"repository": {"url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "html_url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "owner": { "name": "ESMF"}}, "pusher": { "name": "GitHub Action", "email": "esmf-dev@eclipse.org"}}' + SHA1="$(echo -n "${DATA}" | openssl dgst -sha1 -hmac "${WEBHOOK_SECRET}" | sed 's/SHA1(stdin)= //')" + curl -X POST https://ci.eclipse.org/esmf/github-webhook/ -H "Content-Type: application/json" -H "X-GitHub-Event: push" -H "X-Hub-Signature: sha1=${SHA1}" -d "${DATA}" + diff --git a/.github/workflows/tagged_release.yml b/.github/workflows/tagged_release.yml index 8b8cadb6..566bb1fc 100644 --- a/.github/workflows/tagged_release.yml +++ b/.github/workflows/tagged_release.yml @@ -218,4 +218,3 @@ jobs: DATA='{"repository": {"url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "html_url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "owner": { "name": "ESMF"}}, "pusher": { "name": "GitHub Action", "email": "esmf-dev@eclipse.org"}}' SHA1="$(echo -n "${DATA}" | openssl dgst -sha1 -hmac "${WEBHOOK_SECRET}" | sed 's/SHA1(stdin)= //')" curl -X POST https://ci.eclipse.org/esmf/github-webhook/ -H "Content-Type: application/json" -H "X-GitHub-Event: push" -H "X-Hub-Signature: sha1=${SHA1}" -d "${DATA}" - diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index aaf46c42..98a09775 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -24,7 +24,8 @@ pipeline { } } - echo "Artifact URL: ${env.artifact_url_win}" + echo "Artifact URL Win: ${env.artifact_url_win}" + echo "Artifact URL Mac: ${env.artifact_url_mac}" echo "Version: ${env.version}" } else { echo "Error: parameters.txt does not exist." @@ -33,7 +34,7 @@ pipeline { } } - stage('Download and unpack artifact') { + stage('Download and unpack Windows artifact') { steps { script { sh "curl -L -H 'Accept: application/vnd.github.v3+json' \ @@ -47,7 +48,19 @@ pipeline { } } - stage('Sign Applications') { + stage('Download Mac artifact') { + steps { + script { + sh "curl -L -H 'Accept: application/vnd.github.v3+json' \ + -H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \ + '${env.artifact_url_mac}' \ + --output 'ame-backend-${env.version}-mac'" + sh "ls -a" + } + } + } + + stage('Sign Windows Applications') { steps { script { sh "mkdir -p signed_dir" @@ -58,12 +71,23 @@ pipeline { } } - stage('Release signed WINDOWS artifact to GitHub Releases') { + stage('Sign Mac Applications') { + steps { + script { + sh "mkdir -p signed_dir" + sh "curl -o signed_dir/ame-backend-${env.version}-mac -F file=@ame-backend-${env.version}-mac https://cbi.eclipse.org/macos/codesign/sign" + sh "ls -a" + } + } + } + + stage('Release signed Windows and Mac artifact to GitHub Releases') { steps { script { def repo = "eclipse-esmf/esmf-aspect-model-editor-backend" def tagName = "v${env.version}" - def fileName = "aspect-model-editor-v${env.version}-win-signed.zip" + def fileNameWin = "aspect-model-editor-v${env.version}-win-signed.zip" + def fileNameMac = "ame-backend-${env.version}-mac" def releaseId = "" def tagExists = sh(script: """ @@ -100,7 +124,17 @@ pipeline { -H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \ -H "Content-Type: application/octet-stream" \ --data-binary @${fileName} \ - "https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=${fileName}" + "https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=${fileNameWin}" + """ + + sh """ + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \\ + -H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @${fileName} \ + "https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=${fileNameMac}" """ sh """ From 928ab341e83c740eceb529ea16c37ef0e9a86d99 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 10 May 2024 15:17:05 +0200 Subject: [PATCH 02/24] Add plist file and notarization for mac --- .jenkins/Jenkinsfile | 40 ++++++++++++++++++++++++++++++++-- entitlements.plist | 51 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 entitlements.plist diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 98a09775..a6b9f014 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -67,6 +67,7 @@ pipeline { sh "find unpack_dir -name '*.dll' -exec mv {} signed_dir \\;" sh "curl -o signed_dir/ame-backend-${env.version}-win.exe -F file=@unpack_dir/ame-backend-${env.version}-win.exe https://cbi.eclipse.org/authenticode/sign" sh "zip -r aspect-model-editor-v${env.version}-win-signed.zip signed_dir" + sh "ls -a signed_dir" } } } @@ -75,8 +76,43 @@ pipeline { steps { script { sh "mkdir -p signed_dir" - sh "curl -o signed_dir/ame-backend-${env.version}-mac -F file=@ame-backend-${env.version}-mac https://cbi.eclipse.org/macos/codesign/sign" - sh "ls -a" + sh "curl -o signed_dir/ame-backend-${env.version}-mac -F file=@ame-backend-${env.version}-mac -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" + sh "ls -a signed_dir" + } + } + } + + stage('MacOS Notarization') { + steps { + script { + def buildDir = "${WORKSPACE}/signed_dir" + def macOsFile = "ame-backend-${env.version}-mac" + + def jsonOptions = "options={\"primaryBundleId\": \"org.eclipse.esmf\", \"staple\": true};type=application/json" + + def response = sh(script: "curl -s -X POST -F file=@${macOsFile} -F '${jsonOptions}' https://cbi.eclipse.org/macos/xcrun/notarize", returnStdout: true).trim() + + def jsonSlurper = new groovy.json.JsonSlurper() + def object = jsonSlurper.parseText(response) + def uuid = object.uuid + def status = object.notarizationStatus.status + + while (status == 'IN_PROGRESS') { + sleep(time: 1, unit: 'MINUTES') + response = sh(script: "curl -s https://cbi.eclipse.org/macos/xcrun/${uuid}/status", returnStdout: true).trim() + def inProgressResponse = jsonSlurper.parseText(response) + uuid = inProgressResponse.uuid + status = inProgressResponse.notarizationStatus.status + } + + if (status != 'COMPLETE') { + echo "Notarization failed: ${response}" + error("Notarization failed.") + } + + sh "rm '${dmg}'" + + sh "curl -JO https://cbi.eclipse.org/macos/xcrun/${uuid}/download" } } } diff --git a/entitlements.plist b/entitlements.plist new file mode 100644 index 00000000..8e77f041 --- /dev/null +++ b/entitlements.plist @@ -0,0 +1,51 @@ + + + + + + com.apple.security.cs.allow-jit + + + + com.apple.security.cs.allow-unsigned-executable-memory + + + + com.apple.security.cs.allow-dyld-environment-variables + + + + com.apple.security.cs.disable-library-validation + + + + com.apple.security.get-task-allow + + + + com.apple.security.network.client + + com.apple.security.network.server + + + + com.apple.security.files.user-selected.read-write + + com.apple.security.files.downloads.read-write + + com.apple.security.files.all.read-write + + + + com.apple.security.device.audio-input + + + + com.apple.security.device.camera + + + + com.apple.security.personal-information.location + + + From fac5c72e96f92f7d1827fcdd37573d642e7b0e01 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 10 May 2024 15:32:59 +0200 Subject: [PATCH 03/24] Update pull_request_check.yml --- .github/workflows/pull_request_check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index 067955ce..ff7564d1 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -118,6 +118,9 @@ jobs: needs: build runs-on: ubuntu-latest steps: + - name: Checkout project + uses: actions/checkout@v3 + # Sign (Windows & Mac) executable - name: Get Artifact ID (Windows & Mac) shell: bash From b3aeeaaf6ea394ce90ae3ec08fdadfc979d5a37f Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 10 May 2024 15:54:37 +0200 Subject: [PATCH 04/24] WIP --- .github/workflows/pull_request_check.yml | 8 ++++---- .jenkins/Jenkinsfile | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index ff7564d1..c7a6fdac 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -111,7 +111,7 @@ jobs: if: matrix.os == 'macos-12' uses: actions/upload-artifact@v4 with: - name: ame-backend-${{ matrix.os }} + name: aspect-model-editor-vDEV-SNAPSHOT-mac path: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac release: @@ -128,13 +128,13 @@ jobs: # Get the list of artifacts for the specified workflow run response=$(curl -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/${{ github.repository_owner }}/$(echo '${{ github.repository }}' | cut -d'/' -f2)/actions/runs/${{ github.run_id }}/artifacts") - # Filter out the ID of the artifact with a name that contains "mac" - artifact_id_mac=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("mac")) | .id') + # Filter out the ID of the artifacts artifact_id_win=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("win")) | .id') + artifact_id_mac=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("mac")) | .id') # Save the artifact ID in an environment variable - echo "ARTIFACT_ID_MAC=$artifact_id_mac" >> $GITHUB_ENV echo "ARTIFACT_ID_WIN=$artifact_id_win" >> $GITHUB_ENV + echo "ARTIFACT_ID_MAC=$artifact_id_mac" >> $GITHUB_ENV env: TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index a6b9f014..bbaa82a0 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -55,7 +55,8 @@ pipeline { -H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \ '${env.artifact_url_mac}' \ --output 'ame-backend-${env.version}-mac'" - sh "ls -a" + sh "unzip -o aspect-model-editor-v${env.version}-mac.zip -d unpack_dir" + sh "ls -a unpack_dir" } } } @@ -76,7 +77,7 @@ pipeline { steps { script { sh "mkdir -p signed_dir" - sh "curl -o signed_dir/ame-backend-${env.version}-mac -F file=@ame-backend-${env.version}-mac -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" + sh "curl -o signed_dir/ame-backend-${env.version}-mac -F file=@unpack_dir/ame-backend-${env.version}-mac -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" sh "ls -a signed_dir" } } From 4b9d1779421556353198b128ea2b26fb5184c0e9 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 10 May 2024 16:18:47 +0200 Subject: [PATCH 05/24] Update pull_request_check.yml --- .github/workflows/pull_request_check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index c7a6fdac..f1699f41 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -146,8 +146,8 @@ jobs: BRANCH_NAME="pre_release_configuration" echo "artifact_url_win=$ARTIFACT_URL_WIN" > parameters.txt - echo "artifact_url_mac=$ARTIFACT_URL_MAC" > parameters.txt - echo "version=${{ github.event.inputs.release_version }}" >> parameters.txt + echo "artifact_url_mac=$ARTIFACT_URL_MAC" >> parameters.txt + echo "version=DEV-SNAPSHOT" >> parameters.txt git config --global user.email "github-actions@github.com" git config --global user.name "github-actions" From ca350237ab5a7e0da3ae0417dbaca69965372347 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 10 May 2024 16:41:33 +0200 Subject: [PATCH 06/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index bbaa82a0..5c5b0182 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -48,19 +48,6 @@ pipeline { } } - stage('Download Mac artifact') { - steps { - script { - sh "curl -L -H 'Accept: application/vnd.github.v3+json' \ - -H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \ - '${env.artifact_url_mac}' \ - --output 'ame-backend-${env.version}-mac'" - sh "unzip -o aspect-model-editor-v${env.version}-mac.zip -d unpack_dir" - sh "ls -a unpack_dir" - } - } - } - stage('Sign Windows Applications') { steps { script { @@ -73,6 +60,19 @@ pipeline { } } + stage('Download Mac artifact') { + steps { + script { + sh "curl -L -H 'Accept: application/vnd.github.v3+json' \ + -H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \ + '${env.artifact_url_mac}' \ + --output 'aspect-model-editor-v${env.version}-mac.zip'" + sh "unzip -o aspect-model-editor-v${env.version}-mac.zip -d unpack_dir" + sh "ls -a unpack_dir" + } + } + } + stage('Sign Mac Applications') { steps { script { From a2bb51e2fa39f1a272a009b0919ac80a882d0516 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 10 May 2024 17:00:44 +0200 Subject: [PATCH 07/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 5c5b0182..cf54fb75 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -86,8 +86,7 @@ pipeline { stage('MacOS Notarization') { steps { script { - def buildDir = "${WORKSPACE}/signed_dir" - def macOsFile = "ame-backend-${env.version}-mac" + def macOsFile = "signed_dir/ame-backend-${env.version}-mac" def jsonOptions = "options={\"primaryBundleId\": \"org.eclipse.esmf\", \"staple\": true};type=application/json" @@ -113,7 +112,7 @@ pipeline { sh "rm '${dmg}'" - sh "curl -JO https://cbi.eclipse.org/macos/xcrun/${uuid}/download" + sh "curl -JO -o signed_dir/ame-backend-${env.version}-mac https://cbi.eclipse.org/macos/xcrun/${uuid}/download" } } } From ed5c79b49c1bebe422b0d65cd2e60fdbdd553d54 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 10 May 2024 18:06:23 +0200 Subject: [PATCH 08/24] Testing something --- .jenkins/Jenkinsfile | 72 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 7 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index cf54fb75..77c8b231 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -73,12 +73,70 @@ pipeline { } } + stage('Create MacOS .app structure') { + steps { + script { + sh ''' + # Define the version + version=$env.version + + # Create the .app structure + mkdir -p "AspectModelEditorBackend.app/Contents/MacOS" + + # Move the downloaded file into the MacOS folder + mv "unpack_dir/ame-backend-${version}-mac" "AspectModelEditorBackend.app/Contents/MacOS/" + + # Set the executable permission + chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-${version}-mac" + + # Create a basic Info.plist file + cat << EOF > MyApp.app/Contents/Info.plist + + + + + CFBundleIdentifier + org.eclipse.ame + CFBundleName + AspectModelEditorBackend + CFBundleVersion + ${version} + CFBundlePackageType + APPL + CFBundleExecutable + start.sh + + + EOF + + # Create start.sh file + cat << EOF > AspectModelEditorBackend.app/Contents/MacOS/start.sh + #!/bin/bash + + # Absolute path to the main executable + APP_PATH="\\$(dirname "\\$0")/ame-backend-${version}-mac" + + # AppleScript that opens a new Terminal window and runs the application + osascript < Date: Fri, 10 May 2024 18:28:59 +0200 Subject: [PATCH 09/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 77c8b231..02d80f7f 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -77,17 +77,14 @@ pipeline { steps { script { sh ''' - # Define the version - version=$env.version - # Create the .app structure mkdir -p "AspectModelEditorBackend.app/Contents/MacOS" # Move the downloaded file into the MacOS folder - mv "unpack_dir/ame-backend-${version}-mac" "AspectModelEditorBackend.app/Contents/MacOS/" + mv "unpack_dir/ame-backend-${env.version}-mac" "AspectModelEditorBackend.app/Contents/MacOS/" # Set the executable permission - chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-${version}-mac" + chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-${env.version}-mac" # Create a basic Info.plist file cat << EOF > MyApp.app/Contents/Info.plist @@ -100,7 +97,7 @@ pipeline { CFBundleName AspectModelEditorBackend CFBundleVersion - ${version} + ${env.version} CFBundlePackageType APPL CFBundleExecutable @@ -114,7 +111,7 @@ pipeline { #!/bin/bash # Absolute path to the main executable - APP_PATH="\\$(dirname "\\$0")/ame-backend-${version}-mac" + APP_PATH="\\$(dirname "\\$0")/ame-backend-${env.version}-mac" # AppleScript that opens a new Terminal window and runs the application osascript < Date: Fri, 10 May 2024 18:49:56 +0200 Subject: [PATCH 10/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 02d80f7f..3d2e72f3 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -81,10 +81,10 @@ pipeline { mkdir -p "AspectModelEditorBackend.app/Contents/MacOS" # Move the downloaded file into the MacOS folder - mv "unpack_dir/ame-backend-${env.version}-mac" "AspectModelEditorBackend.app/Contents/MacOS/" + mv "unpack_dir/ame-backend-\${env.version}-mac" "AspectModelEditorBackend.app/Contents/MacOS/" # Set the executable permission - chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-${env.version}-mac" + chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-\${env.version}-mac" # Create a basic Info.plist file cat << EOF > MyApp.app/Contents/Info.plist @@ -97,7 +97,7 @@ pipeline { CFBundleName AspectModelEditorBackend CFBundleVersion - ${env.version} + \${env.version} CFBundlePackageType APPL CFBundleExecutable @@ -111,7 +111,7 @@ pipeline { #!/bin/bash # Absolute path to the main executable - APP_PATH="\\$(dirname "\\$0")/ame-backend-${env.version}-mac" + APP_PATH="\\$(dirname "\\$0")/ame-backend-\${env.version}-mac" # AppleScript that opens a new Terminal window and runs the application osascript < Date: Mon, 13 May 2024 08:53:22 +0200 Subject: [PATCH 11/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 3d2e72f3..a3b3fe7e 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -76,15 +76,15 @@ pipeline { stage('Create MacOS .app structure') { steps { script { - sh ''' + sh """ # Create the .app structure mkdir -p "AspectModelEditorBackend.app/Contents/MacOS" # Move the downloaded file into the MacOS folder - mv "unpack_dir/ame-backend-\${env.version}-mac" "AspectModelEditorBackend.app/Contents/MacOS/" + mv "unpack_dir/ame-backend-${env.version}-mac" "AspectModelEditorBackend.app/Contents/MacOS/" # Set the executable permission - chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-\${env.version}-mac" + chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-${env.version}-mac" # Create a basic Info.plist file cat << EOF > MyApp.app/Contents/Info.plist @@ -97,7 +97,7 @@ pipeline { CFBundleName AspectModelEditorBackend CFBundleVersion - \${env.version} + ${env.version} CFBundlePackageType APPL CFBundleExecutable @@ -111,12 +111,12 @@ pipeline { #!/bin/bash # Absolute path to the main executable - APP_PATH="\\$(dirname "\\$0")/ame-backend-\${env.version}-mac" + APP_PATH="\$(dirname "\$0\")/ame-backend-${env.version}-mac" # AppleScript that opens a new Terminal window and runs the application osascript < Date: Mon, 13 May 2024 09:51:58 +0200 Subject: [PATCH 12/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index a3b3fe7e..582333f9 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -87,7 +87,7 @@ pipeline { chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-${env.version}-mac" # Create a basic Info.plist file - cat << EOF > MyApp.app/Contents/Info.plist + cat << EOF > AspectModelEditorBackend.app/Contents/Info.plist From 9c6c653f0c62584aa7c59f4df51b0af663505b23 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Mon, 13 May 2024 10:37:40 +0200 Subject: [PATCH 13/24] Change mac strucutre --- .github/workflows/pull_request_check.yml | 9 +++- .jenkins/Jenkinsfile | 60 +----------------------- 2 files changed, 10 insertions(+), 59 deletions(-) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index f1699f41..0e7de095 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -107,12 +107,19 @@ jobs: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-linux aspect-model-editor-runtime/target/*.so + - name: Create DMG (MAC) + if: matrix.os == 'macos-12' + run: | + mkdir dmg_contents + cp aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac dmg_contents/ + hdiutil create -volname "MyApp" -srcfolder dmg_contents -ov -format UDBZ ame-backend.dmg + - name: Upload binary (Mac) if: matrix.os == 'macos-12' uses: actions/upload-artifact@v4 with: name: aspect-model-editor-vDEV-SNAPSHOT-mac - path: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac + path: ame-backend.dmg release: needs: build diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 582333f9..f358ae48 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -73,66 +73,10 @@ pipeline { } } - stage('Create MacOS .app structure') { - steps { - script { - sh """ - # Create the .app structure - mkdir -p "AspectModelEditorBackend.app/Contents/MacOS" - - # Move the downloaded file into the MacOS folder - mv "unpack_dir/ame-backend-${env.version}-mac" "AspectModelEditorBackend.app/Contents/MacOS/" - - # Set the executable permission - chmod +x "AspectModelEditorBackend.app/Contents/MacOS/ame-backend-${env.version}-mac" - - # Create a basic Info.plist file - cat << EOF > AspectModelEditorBackend.app/Contents/Info.plist - - - - - CFBundleIdentifier - org.eclipse.ame - CFBundleName - AspectModelEditorBackend - CFBundleVersion - ${env.version} - CFBundlePackageType - APPL - CFBundleExecutable - start.sh - - - EOF - - # Create start.sh file - cat << EOF > AspectModelEditorBackend.app/Contents/MacOS/start.sh - #!/bin/bash - - # Absolute path to the main executable - APP_PATH="\$(dirname "\$0\")/ame-backend-${env.version}-mac" - - # AppleScript that opens a new Terminal window and runs the application - osascript < Date: Mon, 13 May 2024 10:52:39 +0200 Subject: [PATCH 14/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index f358ae48..22b08ad8 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -76,7 +76,7 @@ pipeline { stage('Sign Mac Applications') { steps { script { - sh "curl -o AspectModelEditorBackend-${env.version}.dmg -F file=@ame-backend.dmg -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" + sh "curl -o AspectModelEditorBackend-${env.version}.dmg -F file=@unpack_dir/ame-backend.dmg -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" sh "ls -a" } } From cbdddf4cac2b4b4cdb08112e540850bbd5f13ab2 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Mon, 13 May 2024 11:25:46 +0200 Subject: [PATCH 15/24] New test --- .github/workflows/pull_request_check.yml | 9 +-------- .jenkins/Jenkinsfile | 11 ++++++++++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index 0e7de095..f1699f41 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -107,19 +107,12 @@ jobs: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-linux aspect-model-editor-runtime/target/*.so - - name: Create DMG (MAC) - if: matrix.os == 'macos-12' - run: | - mkdir dmg_contents - cp aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac dmg_contents/ - hdiutil create -volname "MyApp" -srcfolder dmg_contents -ov -format UDBZ ame-backend.dmg - - name: Upload binary (Mac) if: matrix.os == 'macos-12' uses: actions/upload-artifact@v4 with: name: aspect-model-editor-vDEV-SNAPSHOT-mac - path: ame-backend.dmg + path: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac release: needs: build diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 22b08ad8..71ed1c5b 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -61,6 +61,9 @@ pipeline { } stage('Download Mac artifact') { + agent { + label 'macos' + } steps { script { sh "curl -L -H 'Accept: application/vnd.github.v3+json' \ @@ -68,6 +71,12 @@ pipeline { '${env.artifact_url_mac}' \ --output 'aspect-model-editor-v${env.version}-mac.zip'" sh "unzip -o aspect-model-editor-v${env.version}-mac.zip -d unpack_dir" + + sh """ + mkdir dmg_contents + cp unpack_dir/ame-backend-DEV-SNAPSHOT-mac dmg_contents/ + hdiutil create -volname "ame-backend-DEV-SNAPSHOT-mac" -srcfolder dmg_contents -ov -format UDBZ ame-backend.dmg + """ sh "ls -a unpack_dir" } } @@ -76,7 +85,7 @@ pipeline { stage('Sign Mac Applications') { steps { script { - sh "curl -o AspectModelEditorBackend-${env.version}.dmg -F file=@unpack_dir/ame-backend.dmg -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" + sh "curl -o AspectModelEditorBackend-${env.version}.dmg -F file=@ame-backend.dmg -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" sh "ls -a" } } From 9150704297080c978ff47cb68bf11c0367e45574 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Mon, 13 May 2024 15:06:49 +0200 Subject: [PATCH 16/24] Revert to old logic --- .jenkins/Jenkinsfile | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 71ed1c5b..2370eacd 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -1,3 +1,5 @@ +import groovy.json.JsonSlurper; + pipeline { agent any @@ -61,9 +63,6 @@ pipeline { } stage('Download Mac artifact') { - agent { - label 'macos' - } steps { script { sh "curl -L -H 'Accept: application/vnd.github.v3+json' \ @@ -71,12 +70,6 @@ pipeline { '${env.artifact_url_mac}' \ --output 'aspect-model-editor-v${env.version}-mac.zip'" sh "unzip -o aspect-model-editor-v${env.version}-mac.zip -d unpack_dir" - - sh """ - mkdir dmg_contents - cp unpack_dir/ame-backend-DEV-SNAPSHOT-mac dmg_contents/ - hdiutil create -volname "ame-backend-DEV-SNAPSHOT-mac" -srcfolder dmg_contents -ov -format UDBZ ame-backend.dmg - """ sh "ls -a unpack_dir" } } @@ -85,8 +78,9 @@ pipeline { stage('Sign Mac Applications') { steps { script { - sh "curl -o AspectModelEditorBackend-${env.version}.dmg -F file=@ame-backend.dmg -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" - sh "ls -a" + sh "mkdir -p signed_dir" + sh "curl -o signed_dir/ame-backend-${env.version}-mac -F file=@unpack_dir/ame-backend-${env.version}-mac -F entitlements=@entitlements.plist https://cbi.eclipse.org/macos/codesign/sign" + sh "ls -a signed_dir" } } } @@ -94,23 +88,20 @@ pipeline { stage('MacOS Notarization') { steps { script { - def macOsFile = "AspectModelEditorBackend-${env.version}.dmg" + def macOsFile = "signed_dir/ame-backend-${env.version}-mac" def jsonOptions = "options={\"primaryBundleId\": \"org.eclipse.esmf\", \"staple\": true};type=application/json" - def response = sh(script: "curl -s -X POST -F file=@${macOsFile} -F '${jsonOptions}' https://cbi.eclipse.org/macos/xcrun/notarize", returnStdout: true).trim() - def jsonSlurper = new groovy.json.JsonSlurper() - def object = jsonSlurper.parseText(response) - def uuid = object.uuid - def status = object.notarizationStatus.status + def jsonSlurper = new JsonSlurper() + def json = jsonSlurper.parseText(response) + def uuid = json.uuid + def status = json.notarizationStatus.status while (status == 'IN_PROGRESS') { sleep(time: 1, unit: 'MINUTES') response = sh(script: "curl -s https://cbi.eclipse.org/macos/xcrun/${uuid}/status", returnStdout: true).trim() - def inProgressResponse = jsonSlurper.parseText(response) - uuid = inProgressResponse.uuid - status = inProgressResponse.notarizationStatus.status + json = jsonSlurper.parseText(response) } if (status != 'COMPLETE') { From ec29ab94fd75003f32dcfacab6bee6bc7d95e7c1 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Mon, 13 May 2024 15:39:56 +0200 Subject: [PATCH 17/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 2370eacd..a3200c97 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -95,16 +95,15 @@ pipeline { def jsonSlurper = new JsonSlurper() def json = jsonSlurper.parseText(response) - def uuid = json.uuid - def status = json.notarizationStatus.status + String uuid = json.uuid - while (status == 'IN_PROGRESS') { + while (json.notarizationStatus.status == 'IN_PROGRESS') { sleep(time: 1, unit: 'MINUTES') response = sh(script: "curl -s https://cbi.eclipse.org/macos/xcrun/${uuid}/status", returnStdout: true).trim() json = jsonSlurper.parseText(response) } - if (status != 'COMPLETE') { + if (json.notarizationStatus.status != 'COMPLETE') { echo "Notarization failed: ${response}" error("Notarization failed.") } From 50ce1e1d0e34e0cb64fb080fff499c4cbf50dca5 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Mon, 13 May 2024 16:04:20 +0200 Subject: [PATCH 18/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index a3200c97..06d515d0 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -91,7 +91,7 @@ pipeline { def macOsFile = "signed_dir/ame-backend-${env.version}-mac" def jsonOptions = "options={\"primaryBundleId\": \"org.eclipse.esmf\", \"staple\": true};type=application/json" - def response = sh(script: "curl -s -X POST -F file=@${macOsFile} -F '${jsonOptions}' https://cbi.eclipse.org/macos/xcrun/notarize", returnStdout: true).trim() + def response = sh(script: "curl -X POST -F file=@${macOsFile} -F '${jsonOptions}' https://cbi.eclipse.org/macos/xcrun/notarize", returnStdout: true).trim() def jsonSlurper = new JsonSlurper() def json = jsonSlurper.parseText(response) @@ -99,7 +99,7 @@ pipeline { while (json.notarizationStatus.status == 'IN_PROGRESS') { sleep(time: 1, unit: 'MINUTES') - response = sh(script: "curl -s https://cbi.eclipse.org/macos/xcrun/${uuid}/status", returnStdout: true).trim() + response = sh(script: "curl https://cbi.eclipse.org/macos/xcrun/${uuid}/status", returnStdout: true).trim() json = jsonSlurper.parseText(response) } From 0e9f3062094476bb11afece71d09e69d9a0a954d Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Mon, 13 May 2024 16:30:11 +0200 Subject: [PATCH 19/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 06d515d0..1e79cf92 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -88,7 +88,9 @@ pipeline { stage('MacOS Notarization') { steps { script { - def macOsFile = "signed_dir/ame-backend-${env.version}-mac" + sh "zip -j ame-backend-${env.version}-mac.zip signed_dir/ame-backend-${env.version}-mac" + + def macOsFile = "ame-backend-${env.version}-mac.zip" def jsonOptions = "options={\"primaryBundleId\": \"org.eclipse.esmf\", \"staple\": true};type=application/json" def response = sh(script: "curl -X POST -F file=@${macOsFile} -F '${jsonOptions}' https://cbi.eclipse.org/macos/xcrun/notarize", returnStdout: true).trim() @@ -110,7 +112,7 @@ pipeline { sh "rm '${macOsFile}'" - sh "curl -JO -o AspectModelEditorBackend-${env.version}.app https://cbi.eclipse.org/macos/xcrun/${uuid}/download" + sh "curl -JO -o ame-backend-${env.version}-mac.zip https://cbi.eclipse.org/macos/xcrun/${uuid}/download" } } } From 2a349fa74476d8654c7b0af8cff8266016e44a8b Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Mon, 13 May 2024 16:53:57 +0200 Subject: [PATCH 20/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 1e79cf92..78895766 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -123,7 +123,7 @@ pipeline { def repo = "eclipse-esmf/esmf-aspect-model-editor-backend" def tagName = "v${env.version}" def fileNameWin = "aspect-model-editor-v${env.version}-win-signed.zip" - def fileNameMac = "AspectModelEditorBackend-${env.version}.app" + def fileNameMac = "ame-backend-${env.version}-mac.zip" def releaseId = "" def tagExists = sh(script: """ From 5554b9ca312d46772383b5c8c1038344d46a87c4 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Tue, 14 May 2024 08:53:32 +0200 Subject: [PATCH 21/24] Update Jenkinsfile --- .jenkins/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 78895766..75df0c8d 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -159,7 +159,7 @@ pipeline { -H "Accept: application/vnd.github+json" \\ -H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \ -H "Content-Type: application/octet-stream" \ - --data-binary @${fileName} \ + --data-binary @${fileNameWin} \ "https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=${fileNameWin}" """ @@ -169,7 +169,7 @@ pipeline { -H "Accept: application/vnd.github+json" \\ -H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \ -H "Content-Type: application/octet-stream" \ - --data-binary @${fileName} \ + --data-binary @${fileNameMac} \ "https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=${fileNameMac}" """ From 3a1ee2b650506967b17d402abc7db5ef8993e938 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 24 May 2024 14:10:53 +0200 Subject: [PATCH 22/24] Add final changes for release workflow --- .github/workflows/pull_request_check.yml | 52 ------------------ .github/workflows/tagged_release.yml | 69 +++++++++++------------- .jenkins/Jenkinsfile | 4 +- 3 files changed, 34 insertions(+), 91 deletions(-) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index f1699f41..33611658 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -113,55 +113,3 @@ jobs: with: name: aspect-model-editor-vDEV-SNAPSHOT-mac path: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac - - release: - needs: build - runs-on: ubuntu-latest - steps: - - name: Checkout project - uses: actions/checkout@v3 - - # Sign (Windows & Mac) executable - - name: Get Artifact ID (Windows & Mac) - shell: bash - run: | - # Get the list of artifacts for the specified workflow run - response=$(curl -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/${{ github.repository_owner }}/$(echo '${{ github.repository }}' | cut -d'/' -f2)/actions/runs/${{ github.run_id }}/artifacts") - - # Filter out the ID of the artifacts - artifact_id_win=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("win")) | .id') - artifact_id_mac=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("mac")) | .id') - - # Save the artifact ID in an environment variable - echo "ARTIFACT_ID_WIN=$artifact_id_win" >> $GITHUB_ENV - echo "ARTIFACT_ID_MAC=$artifact_id_mac" >> $GITHUB_ENV - env: - TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Commit Artifact url and version changes and push to pre release branch for jenkins (Windows & Mac) - shell: bash - run: | - ARTIFACT_URL_WIN="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID_WIN/zip" - ARTIFACT_URL_MAC="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID_MAC/zip" - BRANCH_NAME="pre_release_configuration" - - echo "artifact_url_win=$ARTIFACT_URL_WIN" > parameters.txt - echo "artifact_url_mac=$ARTIFACT_URL_MAC" >> parameters.txt - echo "version=DEV-SNAPSHOT" >> parameters.txt - - git config --global user.email "github-actions@github.com" - git config --global user.name "github-actions" - git checkout -b $BRANCH_NAME - git add parameters.txt - git commit -m "Add parameters.txt with artifact_url_win, artifact_url_mac and version" - git push origin $BRANCH_NAME - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Trigger Jenkins Job, for signing executable - shell: bash - run: | - DATA='{"repository": {"url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "html_url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "owner": { "name": "ESMF"}}, "pusher": { "name": "GitHub Action", "email": "esmf-dev@eclipse.org"}}' - SHA1="$(echo -n "${DATA}" | openssl dgst -sha1 -hmac "${WEBHOOK_SECRET}" | sed 's/SHA1(stdin)= //')" - curl -X POST https://ci.eclipse.org/esmf/github-webhook/ -H "Content-Type: application/json" -H "X-GitHub-Event: push" -H "X-Hub-Signature: sha1=${SHA1}" -d "${DATA}" - diff --git a/.github/workflows/tagged_release.yml b/.github/workflows/tagged_release.yml index 566bb1fc..ba46e123 100644 --- a/.github/workflows/tagged_release.yml +++ b/.github/workflows/tagged_release.yml @@ -8,7 +8,7 @@ on: required: true jobs: - gh_tagged_release: + build: name: Create tagged release runs-on: ${{ matrix.os }} strategy: @@ -126,29 +126,21 @@ jobs: aspect-model-editor-runtime/target/*.bat aspect-model-editor-runtime/target/lib/ - # Release Mac and Linux executables - - name: Create GitHub release (Mac) - if: ${{ (matrix.os == 'macos-12') && (!contains( github.ref, '-M' )) }} - uses: svenstaro/upload-release-action@latest + - name: Upload binary (Mac) + if: matrix.os == 'macos-12' + uses: actions/upload-artifact@v4 with: - file_glob: true - overwrite: true - prerelease: false - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: aspect-model-editor-runtime/target/ame-backend!(*.txt)-mac - tag: v${{ github.event.inputs.release_version }} + name: aspect-model-editor-v${{ github.event.inputs.release_version }}-mac + path: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-mac - - name: Create GitHub pre-release (Mac) - if: ${{ (matrix.os == 'macos-12') && (contains( github.ref, '-M' )) }} - uses: svenstaro/upload-release-action@latest + - name: Upload binary (Linux) + if: matrix.os == 'ubuntu-20.04' + uses: actions/upload-artifact@v4 with: - file_glob: true - overwrite: true - prerelease: true - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: aspect-model-editor-runtime/target/ame-backend!(*.txt)-mac - tag: v${{ github.event.inputs.release_version }} + name: aspect-model-editor-v${{ github.event.inputs.release_version }}-linux + path: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-linux + # Release Linux executables - name: Create GitHub release (Linux) if: ${{ (matrix.os == 'ubuntu-20.04') && (!contains( github.ref, '-M' )) }} uses: svenstaro/upload-release-action@latest @@ -157,7 +149,7 @@ jobs: overwrite: true prerelease: false repo_token: ${{ secrets.GITHUB_TOKEN }} - file: aspect-model-editor-runtime/target/ame-backend!(*.txt)-linux + file: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-linux tag: v${{ github.event.inputs.release_version }} - name: Create GitHub pre-release (Linux) @@ -168,51 +160,54 @@ jobs: overwrite: true prerelease: true repo_token: ${{ secrets.GITHUB_TOKEN }} - file: aspect-model-editor-runtime/target/ame-backend!(*.txt)-linux + file: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-linux tag: v${{ github.event.inputs.release_version }} - - name: Setup Git - run: | - git config user.name github-actions - git config user.email github-actions@github.com + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v3 - # Sign Windows executable - - name: Get Artifact ID (Windows) - if: matrix.os == 'windows-latest' + # Sign (Windows & Mac) executable + - name: Get Artifact ID (Windows & Mac) shell: bash run: | # Get the list of artifacts for the specified workflow run response=$(curl -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/${{ github.repository_owner }}/$(echo '${{ github.repository }}' | cut -d'/' -f2)/actions/runs/${{ github.run_id }}/artifacts") - # Filter out the ID of the artifact with a name that contains "windows" - artifact_id=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("win")) | .id') + # Filter out the ID of the artifacts + artifact_id_win=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("win")) | .id') + artifact_id_mac=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("mac")) | .id') # Save the artifact ID in an environment variable - echo "ARTIFACT_ID=$artifact_id" >> $GITHUB_ENV + echo "ARTIFACT_ID_WIN=$artifact_id_win" >> $GITHUB_ENV + echo "ARTIFACT_ID_MAC=$artifact_id_mac" >> $GITHUB_ENV env: TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Commit Artifact url and version changes and push to pre release branch for jenkins (Windows) - if: matrix.os == 'windows-latest' + - name: Commit Artifact url and version changes and push to pre release branch for jenkins (Windows & Mac) shell: bash run: | - ARTIFACT_URL_WIN="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID/zip" + ARTIFACT_URL_WIN="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID_WIN/zip" + ARTIFACT_URL_MAC="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID_MAC/zip" BRANCH_NAME="pre_release_configuration" echo "artifact_url_win=$ARTIFACT_URL_WIN" > parameters.txt + echo "artifact_url_mac=$ARTIFACT_URL_MAC" >> parameters.txt echo "version=${{ github.event.inputs.release_version }}" >> parameters.txt git config --global user.email "github-actions@github.com" git config --global user.name "github-actions" git checkout -b $BRANCH_NAME git add parameters.txt - git commit -m "Add parameters.txt with artifact_url_win and version" + git commit -m "Add parameters.txt with artifact_url_win, artifact_url_mac and version" git push origin $BRANCH_NAME env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Trigger Jenkins Job, for signing executable - if: matrix.os == 'windows-latest' shell: bash run: | DATA='{"repository": {"url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "html_url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "owner": { "name": "ESMF"}}, "pusher": { "name": "GitHub Action", "email": "esmf-dev@eclipse.org"}}' diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 75df0c8d..a1957754 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -56,7 +56,7 @@ pipeline { sh "mkdir -p signed_dir" sh "find unpack_dir -name '*.dll' -exec mv {} signed_dir \\;" sh "curl -o signed_dir/ame-backend-${env.version}-win.exe -F file=@unpack_dir/ame-backend-${env.version}-win.exe https://cbi.eclipse.org/authenticode/sign" - sh "zip -r aspect-model-editor-v${env.version}-win-signed.zip signed_dir" + sh "zip -r aspect-model-editor-v${env.version}-win.zip signed_dir" sh "ls -a signed_dir" } } @@ -122,7 +122,7 @@ pipeline { script { def repo = "eclipse-esmf/esmf-aspect-model-editor-backend" def tagName = "v${env.version}" - def fileNameWin = "aspect-model-editor-v${env.version}-win-signed.zip" + def fileNameWin = "aspect-model-editor-v${env.version}-win.zip" def fileNameMac = "ame-backend-${env.version}-mac.zip" def releaseId = "" From 61c752049879e4faca62cfa8ee43e126f5bcec10 Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 24 May 2024 14:51:51 +0200 Subject: [PATCH 23/24] Change naming --- .github/workflows/pull_request_check.yml | 6 +++--- .github/workflows/tagged_release.yml | 4 ++-- .jenkins/Jenkinsfile | 20 ++++++++++++-------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index 33611658..c8de3498 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -91,7 +91,7 @@ jobs: if: matrix.os == 'windows-latest' uses: actions/upload-artifact@v4 with: - name: aspect-model-editor-vDEV-SNAPSHOT-win + name: ame-backend-win path: | aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-win.exe aspect-model-editor-runtime/target/*.dll @@ -102,7 +102,7 @@ jobs: if: matrix.os == 'ubuntu-20.04' uses: actions/upload-artifact@v4 with: - name: ame-backend-${{ matrix.os }} + name: ame-backend-linux path: | aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-linux aspect-model-editor-runtime/target/*.so @@ -111,5 +111,5 @@ jobs: if: matrix.os == 'macos-12' uses: actions/upload-artifact@v4 with: - name: aspect-model-editor-vDEV-SNAPSHOT-mac + name: ame-backend-mac path: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac diff --git a/.github/workflows/tagged_release.yml b/.github/workflows/tagged_release.yml index ba46e123..7f9320ae 100644 --- a/.github/workflows/tagged_release.yml +++ b/.github/workflows/tagged_release.yml @@ -130,14 +130,14 @@ jobs: if: matrix.os == 'macos-12' uses: actions/upload-artifact@v4 with: - name: aspect-model-editor-v${{ github.event.inputs.release_version }}-mac + name: ame-backend-v${{ github.event.inputs.release_version }}-mac path: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-mac - name: Upload binary (Linux) if: matrix.os == 'ubuntu-20.04' uses: actions/upload-artifact@v4 with: - name: aspect-model-editor-v${{ github.event.inputs.release_version }}-linux + name: ame-backend-v${{ github.event.inputs.release_version }}-linux path: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-linux # Release Linux executables diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index a1957754..1bf45f01 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -39,12 +39,14 @@ pipeline { stage('Download and unpack Windows artifact') { steps { script { + def winOsFile = "ame-backend-v${env.version}-win.zip" sh "curl -L -H 'Accept: application/vnd.github.v3+json' \ -H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \ '${env.artifact_url_win}' \ - --output 'aspect-model-editor-v${env.version}-win.zip'" + --output '${winOsFile}'" sh "mkdir -p unpack_dir" - sh "unzip -o aspect-model-editor-v${env.version}-win.zip -d unpack_dir" + sh "unzip -o ame-backend-v${env.version}-win.zip -d unpack_dir" + sh "rm '${winOsFile}'" sh "ls -a unpack_dir" } } @@ -56,7 +58,7 @@ pipeline { sh "mkdir -p signed_dir" sh "find unpack_dir -name '*.dll' -exec mv {} signed_dir \\;" sh "curl -o signed_dir/ame-backend-${env.version}-win.exe -F file=@unpack_dir/ame-backend-${env.version}-win.exe https://cbi.eclipse.org/authenticode/sign" - sh "zip -r aspect-model-editor-v${env.version}-win.zip signed_dir" + sh "zip -r ame-backend-v${env.version}-win.zip signed_dir" sh "ls -a signed_dir" } } @@ -65,11 +67,13 @@ pipeline { stage('Download Mac artifact') { steps { script { + def macOsFile = "ame-backend-v${env.version}-mac.zip" sh "curl -L -H 'Accept: application/vnd.github.v3+json' \ -H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \ '${env.artifact_url_mac}' \ - --output 'aspect-model-editor-v${env.version}-mac.zip'" - sh "unzip -o aspect-model-editor-v${env.version}-mac.zip -d unpack_dir" + --output '${macOsFile}'" + sh "unzip -o ame-backend-v${env.version}-mac.zip -d unpack_dir" + sh "rm '${macOsFile}'" sh "ls -a unpack_dir" } } @@ -112,7 +116,7 @@ pipeline { sh "rm '${macOsFile}'" - sh "curl -JO -o ame-backend-${env.version}-mac.zip https://cbi.eclipse.org/macos/xcrun/${uuid}/download" + sh "curl -JO -o ame-backend-v${env.version}-mac.zip https://cbi.eclipse.org/macos/xcrun/${uuid}/download" } } } @@ -122,8 +126,8 @@ pipeline { script { def repo = "eclipse-esmf/esmf-aspect-model-editor-backend" def tagName = "v${env.version}" - def fileNameWin = "aspect-model-editor-v${env.version}-win.zip" - def fileNameMac = "ame-backend-${env.version}-mac.zip" + def fileNameWin = "ame-backend-v${env.version}-win.zip" + def fileNameMac = "ame-backend-v${env.version}-mac.zip" def releaseId = "" def tagExists = sh(script: """ From 74154ee231b152826a482f5cea292618e885d19c Mon Sep 17 00:00:00 2001 From: Michele Santoro Date: Fri, 24 May 2024 15:27:20 +0200 Subject: [PATCH 24/24] Fix mac os upload to assets --- .github/workflows/tagged_release.yml | 2 +- .jenkins/Jenkinsfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tagged_release.yml b/.github/workflows/tagged_release.yml index 7f9320ae..c7d8c055 100644 --- a/.github/workflows/tagged_release.yml +++ b/.github/workflows/tagged_release.yml @@ -119,7 +119,7 @@ jobs: if: matrix.os == 'windows-latest' uses: actions/upload-artifact@v4 with: - name: aspect-model-editor-v${{ github.event.inputs.release_version }}-win + name: ame-backend-v${{ github.event.inputs.release_version }}-win path: | aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-win.exe aspect-model-editor-runtime/target/*.dll diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 1bf45f01..7010e43c 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -92,9 +92,9 @@ pipeline { stage('MacOS Notarization') { steps { script { - sh "zip -j ame-backend-${env.version}-mac.zip signed_dir/ame-backend-${env.version}-mac" + sh "zip -j ame-backend-v${env.version}-mac.zip signed_dir/ame-backend-${env.version}-mac" - def macOsFile = "ame-backend-${env.version}-mac.zip" + def macOsFile = "ame-backend-v${env.version}-mac.zip" def jsonOptions = "options={\"primaryBundleId\": \"org.eclipse.esmf\", \"staple\": true};type=application/json" def response = sh(script: "curl -X POST -F file=@${macOsFile} -F '${jsonOptions}' https://cbi.eclipse.org/macos/xcrun/notarize", returnStdout: true).trim()