-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #372 from CoSMoSoftware/CI/gh-actions-m112-v28.1.2
Ci/gh actions m112 v28.1.2
- Loading branch information
Showing
24 changed files
with
713 additions
and
1,486 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,38 @@ | ||
name: 'Download libWebRTC' | ||
description: 'Download libWebRTC' | ||
inputs: | ||
access_token: | ||
description: 'GH App Installation access token - base64' | ||
required: true | ||
release_tag: | ||
description: 'LibWebRTC release tag.' | ||
required: true | ||
asset_pattern: | ||
description: 'Find release asset by defined pattern.' | ||
required: true | ||
default: "^.*" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: | | ||
echo "Looking for libwebrtc using the pattern: ${LIBWEBRTC_ASSETS_PATTERN}" | ||
echo "LibWebRTC release tag: ${LIBWEBRTC_RELEASE_TAG}" | ||
export GH_ACCESS_TOKEN_1H_EXPIRATION=$(echo ${GH_ACCESS_TOKEN_1H_EXPIRATION} | base64 -d) | ||
export LIBWEBRTC_RELEASE_URL=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_ACCESS_TOKEN_1H_EXPIRATION}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/CoSMoSoftware/libwebrtc-cmake/releases/tags/${LIBWEBRTC_RELEASE_TAG} | jq .url | tr -d '"') | ||
echo "LIBWEBRTC_RELEASE_URL: ${LIBWEBRTC_RELEASE_URL}" | ||
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_ACCESS_TOKEN_1H_EXPIRATION}" -H "X-GitHub-Api-Version: 2022-11-28" ${LIBWEBRTC_RELEASE_URL}/assets > assets.json | ||
for asset_pair in $(cat assets.json | jq '.[] | (.id|tostring) + "|" + .name' | tr -d '"') | ||
do | ||
asset_pair=( ${asset_pair//|/ } ) | ||
if [[ $(echo ${asset_pair[1]} | grep -e ${LIBWEBRTC_ASSETS_PATTERN}) ]]; then | ||
echo "Downloading ${asset_pair[1]} from GitHub - GH_ASSET_ID: ${asset_pair[0]}..." | ||
curl -L -H "Accept: application/octet-stream" -H "Authorization: Bearer ${GH_ACCESS_TOKEN_1H_EXPIRATION}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/CoSMoSoftware/libwebrtc-cmake/releases/assets/${asset_pair[0]} > ${asset_pair[1]} | ||
fi | ||
done | ||
rm assets.json | ||
ls -la | ||
env: | ||
GH_ACCESS_TOKEN_1H_EXPIRATION: ${{ inputs.access_token }} | ||
LIBWEBRTC_RELEASE_TAG: ${{ inputs.release_tag }} | ||
LIBWEBRTC_ASSETS_PATTERN: ${{ inputs.asset_pattern }} | ||
shell: bash |
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,44 @@ | ||
name: 'Download libWebRTC' | ||
description: 'Download libWebRTC' | ||
inputs: | ||
access_token: | ||
description: 'GH App Installation access token - base64' | ||
required: true | ||
release_tag: | ||
description: 'LibWebRTC release tag.' | ||
required: true | ||
asset_pattern: | ||
description: 'Find release asset by defined pattern.' | ||
required: true | ||
default: "^.*" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: | | ||
Write-Host "Looking for libwebrtc using the pattern: $env:LIBWEBRTC_ASSETS_PATTERN" | ||
Write-Host "LibWebRTC release tag: $env:LIBWEBRTC_RELEASE_TAG" | ||
$env:GH_ACCESS_TOKEN_1H_EXPIRATION = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:GH_ACCESS_TOKEN_1H_EXPIRATION)).Trim() | ||
$env:LIBWEBRTC_RELEASE_URL = cmd.exe /c curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $env:GH_ACCESS_TOKEN_1H_EXPIRATION" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/CoSMoSoftware/libwebrtc-cmake/releases/tags/$env:LIBWEBRTC_RELEASE_TAG" | jq -r .url | ||
Write-Host $env:LIBWEBRTC_RELEASE_URL | ||
cmd.exe /c curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $env:GH_ACCESS_TOKEN_1H_EXPIRATION" -H "X-GitHub-Api-Version: 2022-11-28" $env:LIBWEBRTC_RELEASE_URL/assets > assets.json | ||
cmd.exe /c type .\assets.json | jq -r '.[] | (.id|tostring) + \"|\" + .name' > assets.txt | ||
Get-Content -Path .\assets.txt | ForEach-Object -Process { | ||
$asset_pair = $_.Split("|") | ||
if ( $asset_pair[1] -match "$env:LIBWEBRTC_ASSETS_PATTERN" ) { | ||
Write-Host "Downloading " $asset_pair[1] " from GitHub - GH_ASSET_ID: " $asset_pair[0] "..." | ||
$asset_url = "https://api.github.com/repos/CoSMoSoftware/libwebrtc-cmake/releases/assets/" + $asset_pair[0] | ||
Write-Host "Asset url:" $asset_url | ||
cmd.exe /c curl -L -H "Accept: application/octet-stream" -H "Authorization: Bearer $env:GH_ACCESS_TOKEN_1H_EXPIRATION" -H "X-GitHub-Api-Version: 2022-11-28" $asset_url --output $asset_pair[1] | ||
} | ||
} | ||
Remove-Item -Path .\assets.json | ||
Remove-Item -Path .\assets.txt | ||
ls | ||
env: | ||
GH_ACCESS_TOKEN_1H_EXPIRATION: ${{ inputs.access_token }} | ||
LIBWEBRTC_RELEASE_TAG: ${{ inputs.release_tag }} | ||
LIBWEBRTC_ASSETS_PATTERN: ${{ inputs.asset_pattern }} | ||
shell: powershell |
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,38 @@ | ||
name: 'Generate access token' | ||
description: 'Generate access token' | ||
inputs: | ||
script: | ||
description: 'Python script for generate access token stored in repo/org secrets.' | ||
required: false | ||
default: "IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKaW1wb3J0IGp3dAppbXBvcnQgdGltZQppbXBvcnQgc3lzCmltcG9ydCByZXF1ZXN0cwppbXBvcnQganNvbgppbXBvcnQgb3MKCgpQRU1fRklMRSA9IG9zLmVudmlyb25bJ1BFTV9GSUxFJ10KR0hfQVBQX0lEID0gb3MuZW52aXJvblsnR0hfQVBQX0lEJ10KR0hfQVBQX0lOU1RBTExBVElPTl9JRCA9IG9zLmVudmlyb25bJ0dIX0FQUF9JTlNUQUxMQVRJT05fSUQnXQoKIyBPcGVuIFBFTQp3aXRoIG9wZW4oUEVNX0ZJTEUsICdyYicpIGFzIHBlbV9maWxlOgogICAgc2lnbmluZ19rZXkgPSBqd3QuandrX2Zyb21fcGVtKHBlbV9maWxlLnJlYWQoKSkKCnBheWxvYWQgPSB7CiAgICAjIElzc3VlZCBhdCB0aW1lCiAgICAnaWF0JzogaW50KHRpbWUudGltZSgpKSwKICAgICMgSldUIGV4cGlyYXRpb24gdGltZSAoMTAgbWludXRlcyBtYXhpbXVtKQogICAgJ2V4cCc6IGludCh0aW1lLnRpbWUoKSkgKyA2MDAsCiAgICAjIEdpdEh1YiBBcHAncyBpZGVudGlmaWVyCiAgICAnaXNzJzogR0hfQVBQX0lECn0KCiMgQ3JlYXRlIEpXVApqd3RfaW5zdGFuY2UgPSBqd3QuSldUKCkKZW5jb2RlZF9qd3QgPSBqd3RfaW5zdGFuY2UuZW5jb2RlKHBheWxvYWQsIHNpZ25pbmdfa2V5LCBhbGc9J1JTMjU2JykKCiMgR2V0IGdoIGFjY2VzcyB0b2tuZQpoZWFkZXJzID0geyJBdXRob3JpemF0aW9uIjogZiJCZWFyZXIge2VuY29kZWRfand0fSIsCiAgICAgICAgICAgIkFjY2VwdCI6ICJhcHBsaWNhdGlvbi92bmQuZ2l0aHViK2pzb24iLAogICAgICAgICAgICJYLUdpdEh1Yi1BcGktVmVyc2lvbiI6ICIyMDIyLTExLTI4IgogICAgICAgICAgIH0KdXJsID0gZiJodHRwczovL2FwaS5naXRodWIuY29tL2FwcC9pbnN0YWxsYXRpb25zL3tHSF9BUFBfSU5TVEFMTEFUSU9OX0lEfS9hY2Nlc3NfdG9rZW5zIgoKciA9IHJlcXVlc3RzLnBvc3QodXJsLCBoZWFkZXJzPWhlYWRlcnMpCmlmIHIuc3RhdHVzX2NvZGUgIT0gMjAxOgogICAgcmFpc2UgSU9FcnJvcihmIkVycm9yOiB7ci5zdGF0dXNfY29kZX0uIEZpbmQgbW9yZSBoZXJlOiBodHRwczovL2RvY3MuZ2l0aHViLmNvbS9lbi9yZXN0L2FwcHMvYXBwcz9hcGlWZXJzaW9uPTIwMjItMTEtMjgjY3JlYXRlLWFuLWluc3RhbGxhdGlvbi1hY2Nlc3MtdG9rZW4tZm9yLWFuLWFwcCIpCmVsc2U6CiAgICByZXNwb25zZV9qc29uID0gci5qc29uKCkKICAgIHByaW50KHJlc3BvbnNlX2pzb25bJ3Rva2VuJ10pCg==" | ||
gh_app_priv_key: | ||
description: 'GitHub Application private key' | ||
required: true | ||
gh_app_id: | ||
description: 'GitHub Application ID' | ||
required: true | ||
gh_app_installation_id: | ||
description: 'GitHub Application intallation ID' | ||
required: true | ||
outputs: | ||
token: | ||
value: ${{ steps.accessToken.outputs.GH_ACCESS_TOKEN_1H_EXPIRATION}} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: accessToken | ||
run: | | ||
python3 -m pip install jwt requests | ||
echo ${GH_APP_RELEASECREATOR_TOKEN_PYTHON_SCRIPT} | base64 -d > ./generate_gh_app_installation_token.py | ||
echo ${GH_APP_RELEASECREATOR_PRIV_KEY} | base64 -d > ./gh_app_priv_key.pem | ||
export PEM_FILE=./gh_app_priv_key.pem | ||
export GH_ACCESS_TOKEN_1H_EXPIRATION=$( python3 ./generate_gh_app_installation_token.py ) | ||
echo "GH_ACCESS_TOKEN_1H_EXPIRATION=$( echo ${GH_ACCESS_TOKEN_1H_EXPIRATION} | base64 )" >> "$GITHUB_OUTPUT" | ||
rm ./gh_app_priv_key.pem ./generate_gh_app_installation_token.py | ||
echo "Access token is ready." | ||
env: | ||
GH_APP_RELEASECREATOR_TOKEN_PYTHON_SCRIPT: ${{ inputs.script }} | ||
GH_APP_RELEASECREATOR_PRIV_KEY: ${{ inputs.gh_app_priv_key }} | ||
GH_APP_ID: ${{ inputs.gh_app_id }} | ||
GH_APP_INSTALLATION_ID: ${{ inputs.gh_app_installation_id }} | ||
shell: bash |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.