Update EMBA version details #37950
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
name: Update EMBA version details | |
on: | |
schedule: | |
- cron: '*/5 * * * *' # do it every 5mins | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
update_version: | |
if: github.repository_owner == 'EMBA-support-repos' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v3 | |
- name: Install requirements | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install curl -y | |
- name: update EMBA version details | |
run: | | |
curl --connect-timeout 5 -s -o - https://github.com/e-m-b-a/emba/blob/master/config/VERSION.txt | grep -w "rawLines" | sed -E 's/.*"rawLines":\[\"([0-9]\.[0-9]\.[0-9])(.*)\"\]\,.*/\1\2/' > EMBA_VERSION.txt || ( echo "[-] Error in VERSION.txt processing" && exit 1) | |
curl --connect-timeout 5 -s -o - https://github.com/e-m-b-a/emba | tr ',' '\n' | grep -o -E "currentOid\":\"[a-zA-Z0-9]{40}" | cut -d ':' -f2 | tr -d '"' > EMBA_GITHUB_HASH.txt || ( echo "[-] Error in EMBA PR id processing" && exit 1) | |
curl --connect-timeout 5 -s -o - https://github.com/e-m-b-a/embark | tr ',' '\n' | grep -o -E "currentOid\":\"[a-zA-Z0-9]{40}" | cut -d ':' -f2 | tr -d '"' > EMBArk_GITHUB_HASH.txt || ( echo "[-] Error in EMBArk PR id processing" && exit 1) | |
curl --connect-timeout 5 -s -o - https://github.com/EMBA-support-repos/nvd-json-data-feeds | tr ',' '\n' | grep -o -E "currentOid\":\"[a-zA-Z0-9]{40}" | cut -d ':' -f2 | tr -d '"' > NVD_HASH.txt || ( echo "[-] Error in NVD PR id processing" && exit 1) | |
curl --connect-timeout 5 -s -o - https://github.com/EMBA-support-repos/EPSS-data | tr ',' '\n' | grep -o -E "currentOid\":\"[a-zA-Z0-9]{40}" | cut -d ':' -f2 | tr -d '"' > EPSS_HASH.txt || ( echo "[-] Error in EPSS PR id processing" && exit 1) | |
sudo docker manifest inspect embeddedanalyzer/emba:latest -v | jq -rc '.Descriptor.digest' | cut -d ':' -f2 > EMBA_CONTAINER_HASH.txt | |
- name: Commit changes | |
id: commit | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git pull origin main | |
git add . | |
if [[ -n "$(git status --porcelain)" ]]; then | |
git commit -m "Bot: Automated EMBA version updates" | |
git push origin main | |
fi |