From 03133dc24cc0c277a0b3ce71dc2f16f367a9b89a Mon Sep 17 00:00:00 2001 From: "Illuminatus [CCIO]" Date: Sat, 27 Apr 2024 13:20:53 -0700 Subject: [PATCH] Workflows to update mithril and node prerelease versions in preview branch, and mithril unstable version in sanchonet branch. --- .github/workflows/mithril-prerelease.yml | 51 ++++++++++++++++++++++++ .github/workflows/mithril-unstable.yml | 44 ++++++++++++++++++++ .github/workflows/node-prerelease.yml | 42 +++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 .github/workflows/mithril-prerelease.yml create mode 100644 .github/workflows/mithril-unstable.yml create mode 100644 .github/workflows/node-prerelease.yml diff --git a/.github/workflows/mithril-prerelease.yml b/.github/workflows/mithril-prerelease.yml new file mode 100644 index 000000000..d03e1e4a4 --- /dev/null +++ b/.github/workflows/mithril-prerelease.yml @@ -0,0 +1,51 @@ +name: Get Mithril pre-release version +on: + workflow_dispatch: + push: + branches: + - alpha + schedule: + - cron: '0 */8 * * *' + +jobs: + get-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: preview + - name: Configure Git + run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + echo "GitHub Actor: ${GITHUB_ACTOR}" >> "$GITHUB_STEP_SUMMARY" + echo "GitHub Email: ${GITHUB_ACTOR}@users.noreply.github.com" >> "$GITHUB_STEP_SUMMARY" + - name: Fetch Mithril release and pre-release versions + run: | + mithril_release="$(curl -s https://api.github.com/repos/input-output-hk/mithril/releases/latest | jq -r '.tag_name')" + mithril_prerelease="$(curl -s https://api.github.com/repos/input-output-hk/mithril/releases | jq -r '.[] | select(.prerelease == true) | select(.tag_name | endswith("-pre")) | .tag_name' | head -n 1)" + if [[ "${mithril_release}-pre" == "${mithril_prerelease}" ]]; then + echo "${mithril_release}" > files/docker/node/release-versions/mithril-prerelease.txt + echo "PRERELEASE_VERSION=${mithril_release}" >> $GITHUB_ENV + echo "Pre-release version: ${mithril_release}" >> $GITHUB_STEP_SUMMARY + echo "Pre-release == Release: True" >> $GITHUB_STEP_SUMMARY + else + echo "${mithril_prerelease}" > files/docker/node/release-versions/mithril-prerelease.txt + echo "PRERELEASE_VERSION=${mithril_prerelease}" >> $GITHUB_ENV + echo "Pre-release version: ${mithril_prerelease}" >> $GITHUB_STEP_SUMMARY + echo "Pre-release == Release: False" >> $GITHUB_STEP_SUMMARY + fi + - name: Check for changes + id: git-check + run: | + export MODIFIED=$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") + echo "MODIFIED=${MODIFIED}" >> "$GITHUB_OUTPUT" + echo "Repository Modified: ${MODIFIED}" >> "$GITHUB_STEP_SUMMARY" + - name: Commit latest pre-release versions + if: steps.git-check.outputs.MODIFIED == 'true' + run: | + echo "Modified files: $(git diff --name-only $(jq -r '.sha' "$GITHUB_OUTPUT"))" >> "$GITHUB_STEP_SUMMARY" + git add files/docker/node/release-versions/mithril-prerelease.txt + git commit -am "New mithril pre-release versions: pre-release ${PRERELEASE_VERSION}" + git push diff --git a/.github/workflows/mithril-unstable.yml b/.github/workflows/mithril-unstable.yml new file mode 100644 index 000000000..0b280bfb5 --- /dev/null +++ b/.github/workflows/mithril-unstable.yml @@ -0,0 +1,44 @@ +name: Get Mithril unstable version +on: + workflow_dispatch: + push: + branches: + - alpha + schedule: + - cron: '0 */8 * * *' + +jobs: + get-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: sanchonet + - name: Configure Git + run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + echo "GitHub Actor: ${GITHUB_ACTOR}" >> "$GITHUB_STEP_SUMMARY" + echo "GitHub Email: ${GITHUB_ACTOR}@users.noreply.github.com" >> "$GITHUB_STEP_SUMMARY" + - name: Fetch Mithril unstable version + run: | + curl -sL https://api.github.com/repos/input-output-hk/mithril/releases | jq -r '.[] | select(.prerelease == true and .tag_name == "unstable") | .tag_name' | head -1 > files/docker/node/release-versions/mithril-unstable.txt + - name: Assign unstable version + run: | + export UNSTABLE_VERSION=$(cat files/docker/node/release-versions/mithril-unstable.txt) + echo "UNSTABLE_VERSION=${UNSTABLE_VERSION}" >> $GITHUB_ENV + echo "Unstable version: ${UNSTABLE_VERSION}" >> $GITHUB_STEP_SUMMARY + - name: Check for changes + id: git-check + run: | + export MODIFIED=$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") + echo "MODIFIED=${MODIFIED}" >> "$GITHUB_OUTPUT" + echo "Repository Modified: ${MODIFIED}" >> "$GITHUB_STEP_SUMMARY" + - name: Commit latest unstable versions + if: steps.git-check.outputs.MODIFIED == 'true' + run: | + echo "Modified files: $(git diff --name-only $(jq -r '.sha' "$GITHUB_OUTPUT"))" >> "$GITHUB_STEP_SUMMARY" + git add files/docker/node/release-versions/mithril-unstable.txt + git commit -am "New mithril unstable versions: unstable ${UNSTABLE_VERSION}" + git push diff --git a/.github/workflows/node-prerelease.yml b/.github/workflows/node-prerelease.yml new file mode 100644 index 000000000..c34001856 --- /dev/null +++ b/.github/workflows/node-prerelease.yml @@ -0,0 +1,42 @@ +name: Get Node pre-release version +on: + workflow_dispatch: + push: + branches: + - alpha + schedule: + - cron: '0 */8 * * *' + +jobs: + get-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: preview + - name: Configure Git + run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + echo "GitHub Actor: ${GITHUB_ACTOR}" >> "$GITHUB_STEP_SUMMARY" + echo "GitHub Email: ${GITHUB_ACTOR}@users.noreply.github.com" >> "$GITHUB_STEP_SUMMARY" + - name: Fetch node pre-release version + run: | + curl -sL https://api.github.com/repos/IntersectMBO/cardano-node/releases | jq -r '.[] | select(.prerelease == true) | .tag_name' | head -1 > files/docker/node/release-versions/cardano-node-prerelease.txt + - name: Assigns pre-release version + run: | + VERSION=$(cat files/docker/node/release-versions/cardano-node-prerelease.txt) + - name: Check for changes + id: git-check + run: | + export MODIFIED=$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") + echo "MODIFIED=${MODIFIED}" >> "$GITHUB_OUTPUT" + echo "Repository Modified: ${MODIFIED}" >> "$GITHUB_STEP_SUMMARY" + - name: Commit latest pre-release versions + if: steps.git-check.outputs.MODIFIED == 'true' + run: | + echo "Modified files: $(git diff --name-only $(jq -r '.sha' "$GITHUB_OUTPUT"))" >> "$GITHUB_STEP_SUMMARY" + git add files/docker/node/release-versions/cardano-node-prerelease.txt + git commit -am "New mithril pre-release versions: pre-release ${PRERELEASE_VERSION}" + git push