Skip to content

Commit

Permalink
Add final changes for release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
michelu89 committed May 24, 2024
1 parent 5554b9c commit 3a1ee2b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 91 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/pull_request_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]"
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": "[email protected]"}}'
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}"
69 changes: 32 additions & 37 deletions .github/workflows/tagged_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: true

jobs:
gh_tagged_release:
build:
name: Create tagged release
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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 [email protected]
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 "[email protected]"
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": "[email protected]"}}'
Expand Down
4 changes: 2 additions & 2 deletions .jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down Expand Up @@ -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 = ""

Expand Down

0 comments on commit 3a1ee2b

Please sign in to comment.