From a7f60a9e5d799badea607268386705fe9c2726e0 Mon Sep 17 00:00:00 2001 From: ColorfulRhino <131405023+ColorfulRhino@users.noreply.github.com> Date: Mon, 8 Jul 2024 22:40:37 +0200 Subject: [PATCH 1/2] Create wokflow to update ORAS_VERSION via auto-PR --- .github/workflows/update-tools.yml | 71 ++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/update-tools.yml diff --git a/.github/workflows/update-tools.yml b/.github/workflows/update-tools.yml new file mode 100644 index 000000000000..478418c78336 --- /dev/null +++ b/.github/workflows/update-tools.yml @@ -0,0 +1,71 @@ +name: Update Tools in Scripts + +permissions: + contents: write + pull-requests: write + +on: + workflow_dispatch: + + push: + branches: + - 'test-workflow-update-oras' + + schedule: + - cron: '0 3 16 * *' # Run monthly at 03:00 AM, on the 16th day of the month + +jobs: + update-version-oras: + name: Update ORAS version + runs-on: ubuntu-latest + + env: + REPO_NAME: oras-project/oras + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get current ORAS version + id: get-version-current + run: | + version_current=$(grep -Po '(?<=ORAS_VERSION=\${ORAS_VERSION:-)[0-9.]+(?=})' lib/functions/general/oci-oras.sh) + echo "version_current=$version_current" >> $GITHUB_OUTPUT + + - name: Get latest ORAS version + id: get-version-latest + # Multi-line string for changelog, see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings + run: | + version_latest=$(curl --silent "https://api.github.com/repos/${{ env.REPO_NAME }}/releases/latest" | jq -r .tag_name) + version_latest=${version_latest#v} # Removing the 'v' prefix since the script uses only plain numbers + echo "version_latest=$version_latest" >> $GITHUB_OUTPUT + { + echo "CHANGE_LOG<> "$GITHUB_ENV" + + - name: Update ORAS_VERSION in script + run: | + version_latest=${{ steps.get-version-latest.outputs.version_latest }} + sed -i "s/ORAS_VERSION=\${ORAS_VERSION:-[0-9.]*}/ORAS_VERSION=\${ORAS_VERSION:-$version_latest}/g" lib/functions/general/oci-oras.sh + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Update `ORAS_VERSION` to ${{ steps.get-version-latest.outputs.version_latest }}" + branch: update-version-oras-${{ steps.get-version-latest.outputs.version_latest }} + title: "Bump `ORAS_VERSION` from ${{ steps.get-version-current.outputs.version_current }} to ${{ steps.get-version-latest.outputs.version_latest }}" + body: | + Bumps `ORAS_VERSION` from ${{ steps.get-version-current.outputs.version_current }} to ${{ steps.get-version-latest.outputs.version_latest }}. + +
Release notes + Sourced from [oras-project/oras's releases](https://github.com/oras-project/oras/releases). +
+ + ${{ env.CHANGE_LOG }} + +
+
+ labels: update, automated pr From 0b40ce3ebd6f584ffe5dd8fababfe30c78fd6627 Mon Sep 17 00:00:00 2001 From: ColorfulRhino <131405023+ColorfulRhino@users.noreply.github.com> Date: Tue, 9 Jul 2024 00:29:29 +0000 Subject: [PATCH 2/2] Update `ORAS_VERSION` to 1.2.0 --- lib/functions/general/oci-oras.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions/general/oci-oras.sh b/lib/functions/general/oci-oras.sh index 19eb88c4c136..71e99a591ca8 100644 --- a/lib/functions/general/oci-oras.sh +++ b/lib/functions/general/oci-oras.sh @@ -9,7 +9,7 @@ function run_tool_oras() { # Default version - ORAS_VERSION=${ORAS_VERSION:-0.16.0} # https://github.com/oras-project/oras/releases + ORAS_VERSION=${ORAS_VERSION:-1.2.0} # https://github.com/oras-project/oras/releases #ORAS_VERSION=${ORAS_VERSION:-"1.0.0-rc.1"} # https://github.com/oras-project/oras/releases declare non_cache_dir="/armbian-tools/oras" # To deploy/reuse cached ORAS in a Docker image.