From 1b7940fbe69463cc2686ad07bfaa88ce80008fa2 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Thu, 5 Jun 2025 15:07:22 -0700 Subject: [PATCH 01/20] test: trigger github actions --- .github/workflows/release.yml | 5 ++++- scripts/create_code_editor_tarball.sh | 0 2 files changed, 4 insertions(+), 1 deletion(-) mode change 100644 => 100755 scripts/create_code_editor_tarball.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 463fed8b3..f9d402be7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,6 +75,7 @@ jobs: sha256_hash: ${{ steps.build.outputs.sha256_hash }} assets: ${{ steps.publish.outputs.assets }} + ''' update-feedstock-files: runs-on: ubuntu-latest needs: [check-tag, release] @@ -98,4 +99,6 @@ jobs: SHA256=${{ needs.release.outputs.sha256_hash }} sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml - name: Run diff - run: git diff \ No newline at end of file + run: git diff + ''' + \ No newline at end of file diff --git a/scripts/create_code_editor_tarball.sh b/scripts/create_code_editor_tarball.sh old mode 100644 new mode 100755 From e504982b9a06ee26ff82837a8a219b0a7da9e2c4 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Thu, 5 Jun 2025 15:11:19 -0700 Subject: [PATCH 02/20] fix: correct YAML comment indentation in release.yml --- .github/workflows/release.yml | 48 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9d402be7..ffbd9a166 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,30 +75,28 @@ jobs: sha256_hash: ${{ steps.build.outputs.sha256_hash }} assets: ${{ steps.publish.outputs.assets }} - ''' - update-feedstock-files: - runs-on: ubuntu-latest - needs: [check-tag, release] - steps: - - name: Clone the feedstock repository - uses: actions/checkout@v4 - with: - repository: 'conda-forge/sagemaker-code-editor-feedstock' - ref: 'dev' - - name: Create a new dev branch - run: | - git checkout -b ${{ env.branch-name }} - - name: Update meta.yaml - run: | - VERSION=${{ needs.check-tag.outputs.version }} - sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml - URL="${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }}" - sed -i "s|url: .*\.tar\.gz|url: $URL|" recipe/meta.yaml +# update-feedstock-files: +# runs-on: ubuntu-latest +# needs: [check-tag, release] +# steps: +# - name: Clone the feedstock repository +# uses: actions/checkout@v4 +# with: +# repository: 'conda-forge/sagemaker-code-editor-feedstock' +# ref: 'dev' +# - name: Create a new dev branch +# run: | +# git checkout -b ${{ env.branch-name }} +# - name: Update meta.yaml +# run: | +# VERSION=${{ needs.check-tag.outputs.version }} +# sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml + +# URL="${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }}" +# sed -i "s|url: .*\.tar\.gz|url: $URL|" recipe/meta.yaml - SHA256=${{ needs.release.outputs.sha256_hash }} - sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml - - name: Run diff - run: git diff - ''' - \ No newline at end of file +# SHA256=${{ needs.release.outputs.sha256_hash }} +# sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml +# - name: Run diff +# run: git diff From 89b8949b39ff6af2c052d63b673ff3846521f4dd Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Thu, 5 Jun 2025 15:43:40 -0700 Subject: [PATCH 03/20] fix: remove missing update-csp.patch from series --- patches/series | 1 - 1 file changed, 1 deletion(-) diff --git a/patches/series b/patches/series index dfb7a72a9..b6f476ca0 100644 --- a/patches/series +++ b/patches/series @@ -1,4 +1,3 @@ -update-csp.patch sagemaker-extension.diff disable-online-services.diff disable-telemetry.diff From f1eb7d5eb4e996adfda812f9e1f75b56d5e445ab Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Tue, 10 Jun 2025 13:17:29 -0700 Subject: [PATCH 04/20] CI: Update Node.js to v24 for fixing release job bug --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffbd9a166..f76b7238c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,7 +44,7 @@ jobs: runs-on: ubuntu-latest needs: [check-tag] container: - image: node:20 + image: node:24 steps: - name: Checkout the main branch uses: actions/checkout@v4 @@ -75,7 +75,7 @@ jobs: sha256_hash: ${{ steps.build.outputs.sha256_hash }} assets: ${{ steps.publish.outputs.assets }} - +# temporarily disabled until feedstock is ready # update-feedstock-files: # runs-on: ubuntu-latest # needs: [check-tag, release] From 5161512dc4c6002256654b25188b38bee6caf235 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Tue, 10 Jun 2025 13:32:05 -0700 Subject: [PATCH 05/20] CI: Fix Node.js version and release version in release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f76b7238c..88e669360 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,7 +65,7 @@ jobs: echo "sha256_hash=${SHA256_HASH}" >> $GITHUB_OUTPUT - name: Publish Release id: publish - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v2.3.0 with: name: Code Editor ${{ needs.check-tag.outputs.version }} tag_name: v${{ needs.check-tag.outputs.version }} From c33c2baaa630b5bc1711c449e83f00329c7565f2 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Tue, 10 Jun 2025 13:44:15 -0700 Subject: [PATCH 06/20] CI: Fix release version in release workflow --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88e669360..e462473d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,7 +44,7 @@ jobs: runs-on: ubuntu-latest needs: [check-tag] container: - image: node:24 + image: node:20 steps: - name: Checkout the main branch uses: actions/checkout@v4 @@ -65,7 +65,7 @@ jobs: echo "sha256_hash=${SHA256_HASH}" >> $GITHUB_OUTPUT - name: Publish Release id: publish - uses: softprops/action-gh-release@v2.3.0 + uses: softprops/action-gh-release@v2.2.2 with: name: Code Editor ${{ needs.check-tag.outputs.version }} tag_name: v${{ needs.check-tag.outputs.version }} From 5b01876af2ce6f6d9662702aadfece50bb6ae944 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Wed, 11 Jun 2025 15:57:28 -0700 Subject: [PATCH 07/20] add feedstock module first time --- .github/workflows/release.yml | 47 ++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e462473d7..6b94a96ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,28 +75,29 @@ jobs: sha256_hash: ${{ steps.build.outputs.sha256_hash }} assets: ${{ steps.publish.outputs.assets }} -# temporarily disabled until feedstock is ready -# update-feedstock-files: -# runs-on: ubuntu-latest -# needs: [check-tag, release] -# steps: -# - name: Clone the feedstock repository -# uses: actions/checkout@v4 -# with: -# repository: 'conda-forge/sagemaker-code-editor-feedstock' -# ref: 'dev' -# - name: Create a new dev branch -# run: | -# git checkout -b ${{ env.branch-name }} -# - name: Update meta.yaml -# run: | -# VERSION=${{ needs.check-tag.outputs.version }} -# sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml -# URL="${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }}" -# sed -i "s|url: .*\.tar\.gz|url: $URL|" recipe/meta.yaml + update-feedstock-files: + runs-on: ubuntu-latest + needs: [check-tag, release] + steps: + - name: Clone the feedstock repository + uses: actions/checkout@v4 + with: + repository: 'harvenstar/sagemaker-code-editor-feedstock' + ref: 'dev' + token: ${{ secrets.PERSONAL_TOKEN }} + - name: Create a new dev branch + run: | + git checkout -b ${{ env.branch-name }} + - name: Update meta.yaml + run: | + VERSION=${{ needs.check-tag.outputs.version }} + sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml + + URL="${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }}" + sed -i "s|url: .*\.tar\.gz|url: $URL|" recipe/meta.yaml -# SHA256=${{ needs.release.outputs.sha256_hash }} -# sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml -# - name: Run diff -# run: git diff + SHA256=${{ needs.release.outputs.sha256_hash }} + sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml + - name: Run diff + run: git diff From ec814ae9c3edf1d58d68fba75b4d15c6501c1518 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Thu, 12 Jun 2025 16:51:47 -0700 Subject: [PATCH 08/20] Update GitHub Actions workflow for automated feedstock PR --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b94a96ae..9f457bae6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -101,3 +101,44 @@ jobs: sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml - name: Run diff run: git diff + + #commit and push changes + - name: Commit and push changes + # This step commits the modified 'recipe/meta.yaml' file and pushes it to the remote feedstock repository. + # - Git user name and email are configured for the commit. + # - 'git add' stages the changes. + # - 'git commit' creates a commit with a message including the new version. + # ' || echo "No changes to commit." ' prevents the workflow from failing if there are no changes. + # - The current local branch (e.g., 'auto-update-vX.Y.Z') is pushed to the 'origin' remote. + # This creates the branch on the remote if it doesn't exist. + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add recipe/meta.yaml + git commit -m "Update recipe to v${{ needs.check-tag.outputs.version }}" || echo "No changes to commit." + CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + echo "Pushing changes to origin/${CURRENT_BRANCH}" + git push origin ${CURRENT_BRANCH} + + - name: Create Pull Request + # This step uses the 'peter-evans/create-pull-request' action to create a pull request + # in the feedstock repository. + # - 'token': Uses the PAT from secrets for authentication. + # - 'base': Specifies the target branch for the pull request (e.g., 'dev'). + # - 'title': Sets the title of the pull request, including the new version. + # - 'body': Sets the body of the pull request, detailing the automated changes. + # - 'labels': Optionally applies labels to the pull request. + # The action will use the commit(s) pushed in the previous step from the current branch. + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.PERSONAL_TOKEN }} + base: dev + title: "[Automated] Update recipe to v${{ needs.check-tag.outputs.version }}" + body: | + This is an automated pull request to update the feedstock recipe: + - Version: ${{ needs.check-tag.outputs.version }} + - Tarball URL: ${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }} + - SHA256: ${{ needs.release.outputs.sha256_hash }} + labels: automated-update, bot + # assignees: harvenstar + # reviewers: harvenstar From 5ade1fc8f765dd0d27bb05ed60f6762a3ec96461 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 10:54:55 -0700 Subject: [PATCH 09/20] chore: update release workflow to automate feedstock PR --- .github/workflows/release.yml | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f457bae6..8c85305d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -108,37 +108,49 @@ jobs: # - Git user name and email are configured for the commit. # - 'git add' stages the changes. # - 'git commit' creates a commit with a message including the new version. - # ' || echo "No changes to commit." ' prevents the workflow from failing if there are no changes. - # - The current local branch (e.g., 'auto-update-vX.Y.Z') is pushed to the 'origin' remote. + # ' || echo "No changes to commit." ' prevents the workflow from failing if there are no changes (e.g., if re-running on same version with no actual file change). + # - The current local branch (which is the dynamic branch, e.g., 'auto-update-vX.Y.Z') is pushed to the 'origin' remote. # This creates the branch on the remote if it doesn't exist. run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add recipe/meta.yaml - git commit -m "Update recipe to v${{ needs.check-tag.outputs.version }}" || echo "No changes to commit." + # Check if there are changes to commit to avoid error if meta.yaml is already up-to-date + if git diff --staged --quiet; then + echo "No changes to commit." + else + git commit -m "Update recipe to v${{ needs.check-tag.outputs.version }}" + fi + # Get the current branch name (should be the dynamic one created earlier) CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) echo "Pushing changes to origin/${CURRENT_BRANCH}" git push origin ${CURRENT_BRANCH} - name: Create Pull Request # This step uses the 'peter-evans/create-pull-request' action to create a pull request - # in the feedstock repository. + # in your feedstock repository (harvenstar/sagemaker-code-editor-feedstock). # - 'token': Uses the PAT from secrets for authentication. - # - 'base': Specifies the target branch for the pull request (e.g., 'dev'). + # - 'branch': Explicitly set to the dynamic branch name created earlier. + # - 'base': Specifies the target branch for the pull request (e.g., 'dev' in your fork). # - 'title': Sets the title of the pull request, including the new version. # - 'body': Sets the body of the pull request, detailing the automated changes. # - 'labels': Optionally applies labels to the pull request. - # The action will use the commit(s) pushed in the previous step from the current branch. uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.PERSONAL_TOKEN }} - base: dev + # Explicitly specify the head branch for the PR (the dynamic branch created in this job) + branch: ${{ steps.create_branch.outputs.branch_name }} + # The target branch in your harvenstar/sagemaker-code-editor-feedstock fork + base: dev title: "[Automated] Update recipe to v${{ needs.check-tag.outputs.version }}" body: | - This is an automated pull request to update the feedstock recipe: - - Version: ${{ needs.check-tag.outputs.version }} - - Tarball URL: ${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }} - - SHA256: ${{ needs.release.outputs.sha256_hash }} + This is an automated pull request to update the feedstock recipe for sagemaker-code-editor. + + **Version:** ${{ needs.check-tag.outputs.version }} + **Tarball URL:** ${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }} + **SHA256:** ${{ needs.release.outputs.sha256_hash }} + + This PR was generated automatically by a GitHub Actions workflow. labels: automated-update, bot # assignees: harvenstar # reviewers: harvenstar From ee647c85459769cce912f9cf6f3102c2812a4eff Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 12:03:20 -0700 Subject: [PATCH 10/20] chore: update release workflow to automate feedstock PR: remove global branch --- .github/workflows/release.yml | 98 +++++++++++++++++++++++++++++------ 1 file changed, 83 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c85305d2..033c72d0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,26 +10,33 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + +# Defines permissions granted to the GITHUB_TOKEN for this workflow run. +# 'contents: write' is needed for actions like softprops/action-gh-release to create GitHub releases +# and for peter-evans/create-pull-request if it were to commit to the same repo + permissions: contents: write -env: - branch-name: automated-dev-update # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: + # This job checks if the pushed tag is a valid version tag (starts with 'v') check-tag: runs-on: ubuntu-latest steps: + # This step performs the tag check - name: Check tag is version tag - id: check + id: check # Assign an ID to this step to reference its outputs run: | + # Check if the GitHub reference (github.ref) starts with 'refs/tags/v' if [[ "${{ github.ref }}" == refs/tags/v* ]]; then REF="${{ github.ref }}" VERSION="${REF##refs/tags/v}" echo "Tag starts with 'v'." echo "Version: ${VERSION}" echo "Continuing..." + # Set the version as an output variable for other jobs/steps echo "version=${VERSION}" >> $GITHUB_OUTPUT exit 0 else @@ -39,70 +46,127 @@ jobs: outputs: version: ${{ steps.check.outputs.version }} + # This job builds the release tarball and publishes it to GitHub Releases release: + # Specifies the environment for this job (if you have environments configured) environment: release + # This job runs on the latest Ubuntu environment runs-on: ubuntu-latest needs: [check-tag] container: image: node:20 steps: + # Checks out the repository code at the specific tag that triggered the workflow - name: Checkout the main branch uses: actions/checkout@v4 - name: Install Dependencies run: | apt-get update apt-get install -y build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3 quilt + # Builds the tarball - name: Build Tarball id: build run: | + # Configure git safe directory for operations within the workspace git config --global --add safe.directory /__w/sagemaker-code-editor/sagemaker-code-editor + + # Run the install script to build the tarball, passing the version sh ./scripts/install.sh -t ${{ needs.check-tag.outputs.version }} + # Define the tarball name based on the version TARBALL_NAME="code-editor${{ needs.check-tag.outputs.version }}.tar.gz" + # Set the tarball name as an output variable echo "tarball_name=${TARBALL_NAME}" >> $GITHUB_OUTPUT + # Calculate the SHA256 hash of the tarball SHA256_HASH=$(sha256sum ${TARBALL_NAME} | awk '{ print $1 }') + # Set the SHA256 hash as an output variable echo "sha256_hash=${SHA256_HASH}" >> $GITHUB_OUTPUT + # Publishes the release to GitHub Releases - name: Publish Release - id: publish - uses: softprops/action-gh-release@v2.2.2 + id: publish # Assign an ID to this step to reference its outputs + uses: softprops/action-gh-release@v2.2.2 # Caution: Due to recent update of action-gh-release, it now requires node24. So here we still used the previous version v2.2.2 with: + # Name of the release (e.g., "Code Editor x.y.z") name: Code Editor ${{ needs.check-tag.outputs.version }} + # Tag name for the release (e.g., "vx.y.z") tag_name: v${{ needs.check-tag.outputs.version }} + # Files to upload as release assets files: | ${{ steps.build.outputs.tarball_name }} + # Define outputs for this job outputs: sha256_hash: ${{ steps.build.outputs.sha256_hash }} assets: ${{ steps.publish.outputs.assets }} - + # This job updates the feedstock repository update-feedstock-files: runs-on: ubuntu-latest + # This job depends on the successful completion of 'check-tag' and 'release' jobs needs: [check-tag, release] steps: + # Clones the feedstock repository (your fork) - name: Clone the feedstock repository uses: actions/checkout@v4 with: repository: 'harvenstar/sagemaker-code-editor-feedstock' ref: 'dev' token: ${{ secrets.PERSONAL_TOKEN }} - - name: Create a new dev branch + - name: Create and checkout dynamic update branch + id: create_branch # Assign an ID to this step to reference its outputs run: | - git checkout -b ${{ env.branch-name }} + # Generate a unique branch name using the version (e.g., "auto-update-v1.2.0") + # This prevents conflicts with pre-existing branches from previous runs. + NEW_BRANCH_NAME="auto-update-v${{ needs.check-tag.outputs.version }}" + + git checkout -b ${NEW_BRANCH_NAME} + echo "Created and switched to new branch: ${NEW_BRANCH_NAME}" + + # Output the new branch name for use in later steps (e.g., creating the PR) + echo "branch_name=${NEW_BRANCH_NAME}" >> $GITHUB_OUTPUT + + # Updates the meta.yaml file in the cloned feedstock repository - name: Update meta.yaml run: | VERSION=${{ needs.check-tag.outputs.version }} + META_FILE="recipe/meta.yaml" + + # Check if the meta.yaml file exists at the expected path + if [ ! -f "$META_FILE" ]; then + echo "Error: $META_FILE not found in $(pwd)" + ls -R # List directory contents for debugging + exit 1 + fi + + echo "Updating version to $VERSION in $META_FILE" + # Update the version string in meta.yaml sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml - URL="${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }}" - sed -i "s|url: .*\.tar\.gz|url: $URL|" recipe/meta.yaml + # Safely parse the download URL from the assets JSON output of the release job + # Ensure jq is available (ubuntu-latest runners typically include it) + # If not, you might need an `apt-get install jq` step or use a different parsing method. + URL_JSON='${{ toJSON(needs.release.outputs.assets) }}' + URL=$(echo "$URL_JSON" | jq -r '.[0].browser_download_url') # Extracts the browser_download_url of the first asset + + if [ -z "$URL" ] || [ "$URL" == "null" ]; then + echo "Error: Could not extract URL from assets. Assets JSON: $URL_JSON" + exit 1 + fi + echo "Updating URL to $URL in $META_FILE" + # Update the URL in meta.yaml, using '|' as sed delimiter to avoid escaping slashes in URL + sed -i "s|url: .*\.tar\.gz|url: $URL|" $META_FILE + # Update the SHA256 hash in meta.yaml SHA256=${{ needs.release.outputs.sha256_hash }} - sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml - - name: Run diff - run: git diff + echo "Updating SHA256 to $SHA256 in $META_FILE" + # Update the SHA256 hash in meta.yaml (matches a hexadecimal string) + sed -i "s|sha256: [0-9a-fA-F]*|sha256: $SHA256|" $META_FILE + + # Displays the differences in meta.yaml after modifications for verification + - name: Show changes in meta.yaml + run: git diff recipe/meta.yaml - #commit and push changes + # Commits the changes to meta.yaml and pushes them to the dynamic branch in your feedstock fork - name: Commit and push changes # This step commits the modified 'recipe/meta.yaml' file and pushes it to the remote feedstock repository. # - Git user name and email are configured for the commit. @@ -115,16 +179,20 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add recipe/meta.yaml + # Check if there are changes to commit to avoid error if meta.yaml is already up-to-date if git diff --staged --quiet; then echo "No changes to commit." else git commit -m "Update recipe to v${{ needs.check-tag.outputs.version }}" fi + # Get the current branch name (should be the dynamic one created earlier) CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) echo "Pushing changes to origin/${CURRENT_BRANCH}" - git push origin ${CURRENT_BRANCH} + # Push the dynamic branch to your feedstock fork (origin) + # The '-u' flag sets the upstream branch for future pushes/pulls from this local branch. + git push -u origin ${CURRENT_BRANCH} - name: Create Pull Request # This step uses the 'peter-evans/create-pull-request' action to create a pull request From b91f60ae4f37cb9e78b648c72698842551dbe057 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 12:17:54 -0700 Subject: [PATCH 11/20] chore: update release workflow to automate feedstock PR: remove global branch --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 033c72d0b..79aa8be5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -140,7 +140,7 @@ jobs: echo "Updating version to $VERSION in $META_FILE" # Update the version string in meta.yaml - sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml + sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" $META_FILE # Safely parse the download URL from the assets JSON output of the release job # Ensure jq is available (ubuntu-latest runners typically include it) From d081c38213f6cc925c5f222ed183c9b2cca11e98 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 12:18:59 -0700 Subject: [PATCH 12/20] chore: update release workflow to automate feedstock PR: change recipe/meta.yaml to --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 79aa8be5d..3e62961e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,6 +112,7 @@ jobs: repository: 'harvenstar/sagemaker-code-editor-feedstock' ref: 'dev' token: ${{ secrets.PERSONAL_TOKEN }} + - name: Create and checkout dynamic update branch id: create_branch # Assign an ID to this step to reference its outputs run: | @@ -143,8 +144,6 @@ jobs: sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" $META_FILE # Safely parse the download URL from the assets JSON output of the release job - # Ensure jq is available (ubuntu-latest runners typically include it) - # If not, you might need an `apt-get install jq` step or use a different parsing method. URL_JSON='${{ toJSON(needs.release.outputs.assets) }}' URL=$(echo "$URL_JSON" | jq -r '.[0].browser_download_url') # Extracts the browser_download_url of the first asset From 39395126f65da23843061abdfd21c7de56bf2332 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 12:25:47 -0700 Subject: [PATCH 13/20] chore: update release workflow to automate feedstock PR: change Update meta.yaml --- .github/workflows/release.yml | 80 +++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e62961e9..98255e90d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -127,40 +127,92 @@ jobs: echo "branch_name=${NEW_BRANCH_NAME}" >> $GITHUB_OUTPUT # Updates the meta.yaml file in the cloned feedstock repository + # Updates the meta.yaml file in the cloned feedstock repository - name: Update meta.yaml run: | + # Get the version from the 'check-tag' job's output VERSION=${{ needs.check-tag.outputs.version }} META_FILE="recipe/meta.yaml" # Check if the meta.yaml file exists at the expected path if [ ! -f "$META_FILE" ]; then echo "Error: $META_FILE not found in $(pwd)" - ls -R # List directory contents for debugging + ls -R # List directory contents for debugging if file not found exit 1 fi echo "Updating version to $VERSION in $META_FILE" - # Update the version string in meta.yaml - sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" $META_FILE + # Update the version string in meta.yaml using sed + # This command finds the line "{% set version = "..." %}" and replaces the version number. + sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" "$META_FILE" - # Safely parse the download URL from the assets JSON output of the release job - URL_JSON='${{ toJSON(needs.release.outputs.assets) }}' - URL=$(echo "$URL_JSON" | jq -r '.[0].browser_download_url') # Extracts the browser_download_url of the first asset + # --- Start: Robust URL Extraction from Release Assets --- + + # Debugging: Print the raw 'assets' output from the 'release' job. + # This helps to see exactly what data is being passed for parsing. + echo "Raw assets output from release job: '${{ needs.release.outputs.assets }}'" + + # Store the 'assets' output (converted to a JSON string) from the 'release' job into a shell variable. + # The toJSON() function ensures that the output is a valid JSON string, + # which is important if the 'assets' output itself might not be strictly JSON formatted. + ASSETS_JSON='${{ toJSON(needs.release.outputs.assets) }}' + + # Critical Check: Verify if ASSETS_JSON is empty, the literal string "null", or an empty JSON string '""'. + # These conditions usually indicate that the 'Publish Release' step failed to produce + # any asset information (e.g., no files uploaded, or the step errored out). + if [ -z "$ASSETS_JSON" ] || [ "$ASSETS_JSON" = "null" ] || [ "$ASSETS_JSON" = '""' ]; then + echo "Error: Critical - The 'assets' output from the 'Publish Release' step is empty, null, or an empty JSON string." + echo "Value of ASSETS_JSON was: '$ASSETS_JSON'" + echo "This strongly suggests that the 'Publish Release' step did not successfully provide asset information." + echo "Please thoroughly check the logs of the 'Publish Release' step in the 'release' job for errors or issues like missing file uploads." + exit 1 # Exit with an error if asset data is missing or invalid. + fi + + # Attempt to parse the browser_download_url of the first asset using jq. + # The '-r' flag outputs the raw string value without JSON quotes. + # We store both the output of jq and its exit code to diagnose any parsing issues. + URL_OUTPUT=$(echo "$ASSETS_JSON" | jq -r '.[0].browser_download_url') + JQ_EXIT_CODE=$? # Capture jq's exit code immediately after it runs. + + # Check if jq command failed (non-zero exit code). + if [ $JQ_EXIT_CODE -ne 0 ]; then + echo "Error: jq command failed with exit code $JQ_EXIT_CODE while trying to parse assets JSON." + echo "Input to jq was: $ASSETS_JSON" + # jq typically prints its own specific error message to stderr, which will also appear in the GitHub Actions log. + # This often means ASSETS_JSON was not a valid JSON array as jq expected (e.g., it was a string, an object, or malformed). + exit 1 # Exit with an error if jq failed. + fi - if [ -z "$URL" ] || [ "$URL" == "null" ]; then - echo "Error: Could not extract URL from assets. Assets JSON: $URL_JSON" - exit 1 + # After jq runs successfully (exit code 0), check if the extracted URL_OUTPUT is empty or the string "null". + # jq -r outputs the literal string "null" if the JSON value at the path is actually null. + # An empty string could occur if the field exists but is empty, or if the path was valid but led to an empty value. + if [ -z "$URL_OUTPUT" ] || [ "$URL_OUTPUT" = "null" ]; then + echo "Error: Extracted URL is empty or null, even though the jq command was successful (exit code 0)." + echo "jq output for URL was: '$URL_OUTPUT'" + echo "Input to jq was: $ASSETS_JSON" + echo "This could mean the assets array was empty (e.g., '[]'), or the first asset object (index [0]) did not have a 'browser_download_url' field, or that field's value was explicitly null." + exit 1 # Exit with an error if the URL couldn't be meaningfully extracted. fi + + # If all checks pass, assign the successfully extracted URL to the URL variable. + URL="$URL_OUTPUT" + + # --- End: Robust URL Extraction --- + echo "Updating URL to $URL in $META_FILE" - # Update the URL in meta.yaml, using '|' as sed delimiter to avoid escaping slashes in URL - sed -i "s|url: .*\.tar\.gz|url: $URL|" $META_FILE + # Update the URL in meta.yaml using sed. + # The '|' character is used as a delimiter for sed to avoid issues with slashes '/' in the URL. + # This command finds "url: ...tar.gz" and replaces the URL part. + sed -i "s|url: .*\.tar\.gz|url: $URL|" "$META_FILE" - # Update the SHA256 hash in meta.yaml + # Get the SHA256 hash from the 'release' job's output SHA256=${{ needs.release.outputs.sha256_hash }} echo "Updating SHA256 to $SHA256 in $META_FILE" - # Update the SHA256 hash in meta.yaml (matches a hexadecimal string) - sed -i "s|sha256: [0-9a-fA-F]*|sha256: $SHA256|" $META_FILE + # Update the SHA256 hash in meta.yaml using sed. + # This command finds "sha256: " and replaces the hex string. + sed -i "s|sha256: [0-9a-fA-F]*|sha256: $SHA256|" "$META_FILE" + # Displays the differences in meta.yaml after modifications for verification - name: Show changes in meta.yaml run: git diff recipe/meta.yaml From adbe5d63fed7267dc0944126019b490f24bcca95 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 12:30:06 -0700 Subject: [PATCH 14/20] chore: update release workflow to automate feedstock PR: change Update meta.yamlv1.2.6 --- .github/workflows/release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 98255e90d..043e51cd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -135,7 +135,8 @@ jobs: META_FILE="recipe/meta.yaml" # Check if the meta.yaml file exists at the expected path - if [ ! -f "$META_FILE" ]; then + if [ ! -f "$META_FILE" + ]; then echo "Error: $META_FILE not found in $(pwd)" ls -R # List directory contents for debugging if file not found exit 1 @@ -171,7 +172,7 @@ jobs: # Attempt to parse the browser_download_url of the first asset using jq. # The '-r' flag outputs the raw string value without JSON quotes. # We store both the output of jq and its exit code to diagnose any parsing issues. - URL_OUTPUT=$(echo "$ASSETS_JSON" | jq -r '.[0].browser_download_url') + URL_OUTPUT=$(jq -r '.[0].browser_download_url' <<< "$ASSETS_JSON") JQ_EXIT_CODE=$? # Capture jq's exit code immediately after it runs. # Check if jq command failed (non-zero exit code). @@ -212,7 +213,7 @@ jobs: # This command finds "sha256: " and replaces the hex string. sed -i "s|sha256: [0-9a-fA-F]*|sha256: $SHA256|" "$META_FILE" - + # Displays the differences in meta.yaml after modifications for verification - name: Show changes in meta.yaml run: git diff recipe/meta.yaml From 29cfa94a9121ca4daefa9f55c85425bae438d5ba Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 13:31:49 -0700 Subject: [PATCH 15/20] chore: update release workflow to automate feedstock PR: change Update meta.yamlv1.2.7 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 043e51cd3..1b11a6d4c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -161,7 +161,7 @@ jobs: # Critical Check: Verify if ASSETS_JSON is empty, the literal string "null", or an empty JSON string '""'. # These conditions usually indicate that the 'Publish Release' step failed to produce # any asset information (e.g., no files uploaded, or the step errored out). - if [ -z "$ASSETS_JSON" ] || [ "$ASSETS_JSON" = "null" ] || [ "$ASSETS_JSON" = '""' ]; then + if [[ -z "$ASSETS_JSON" || "$ASSETS_JSON" == "null" || "$ASSETS_JSON" == '""' ]]; then echo "Error: Critical - The 'assets' output from the 'Publish Release' step is empty, null, or an empty JSON string." echo "Value of ASSETS_JSON was: '$ASSETS_JSON'" echo "This strongly suggests that the 'Publish Release' step did not successfully provide asset information." From 35695dfca3359a142267d3048d0e5b4989586975 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 13:36:21 -0700 Subject: [PATCH 16/20] chore: update release workflow to automate feedstock PR: change Update meta.yamlv1.2.8 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b11a6d4c..882a63fdb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -136,7 +136,7 @@ jobs: # Check if the meta.yaml file exists at the expected path if [ ! -f "$META_FILE" - ]; then + ]; then echo "Error: $META_FILE not found in $(pwd)" ls -R # List directory contents for debugging if file not found exit 1 From d0cf52b6ed5a1fa4c1234b02b4c484cef920bc24 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 13:40:17 -0700 Subject: [PATCH 17/20] chore: update release workflow to automate feedstock PR: change Update meta.yamlv1.2.10 --- .github/workflows/release.yml | 80 ++--------------------------------- 1 file changed, 4 insertions(+), 76 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 882a63fdb..026d1921e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -132,87 +132,15 @@ jobs: run: | # Get the version from the 'check-tag' job's output VERSION=${{ needs.check-tag.outputs.version }} - META_FILE="recipe/meta.yaml" - # Check if the meta.yaml file exists at the expected path - if [ ! -f "$META_FILE" - ]; then - echo "Error: $META_FILE not found in $(pwd)" - ls -R # List directory contents for debugging if file not found - exit 1 - fi - - echo "Updating version to $VERSION in $META_FILE" - # Update the version string in meta.yaml using sed - # This command finds the line "{% set version = "..." %}" and replaces the version number. - sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" "$META_FILE" - - # --- Start: Robust URL Extraction from Release Assets --- - # Debugging: Print the raw 'assets' output from the 'release' job. - # This helps to see exactly what data is being passed for parsing. - echo "Raw assets output from release job: '${{ needs.release.outputs.assets }}'" + sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml - # Store the 'assets' output (converted to a JSON string) from the 'release' job into a shell variable. - # The toJSON() function ensures that the output is a valid JSON string, - # which is important if the 'assets' output itself might not be strictly JSON formatted. - ASSETS_JSON='${{ toJSON(needs.release.outputs.assets) }}' + URL="${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }}" + sed -i "s|url: .*\.tar\.gz|url: $URL|" recipe/meta.yaml - # Critical Check: Verify if ASSETS_JSON is empty, the literal string "null", or an empty JSON string '""'. - # These conditions usually indicate that the 'Publish Release' step failed to produce - # any asset information (e.g., no files uploaded, or the step errored out). - if [[ -z "$ASSETS_JSON" || "$ASSETS_JSON" == "null" || "$ASSETS_JSON" == '""' ]]; then - echo "Error: Critical - The 'assets' output from the 'Publish Release' step is empty, null, or an empty JSON string." - echo "Value of ASSETS_JSON was: '$ASSETS_JSON'" - echo "This strongly suggests that the 'Publish Release' step did not successfully provide asset information." - echo "Please thoroughly check the logs of the 'Publish Release' step in the 'release' job for errors or issues like missing file uploads." - exit 1 # Exit with an error if asset data is missing or invalid. - fi - - # Attempt to parse the browser_download_url of the first asset using jq. - # The '-r' flag outputs the raw string value without JSON quotes. - # We store both the output of jq and its exit code to diagnose any parsing issues. - URL_OUTPUT=$(jq -r '.[0].browser_download_url' <<< "$ASSETS_JSON") - JQ_EXIT_CODE=$? # Capture jq's exit code immediately after it runs. - - # Check if jq command failed (non-zero exit code). - if [ $JQ_EXIT_CODE -ne 0 ]; then - echo "Error: jq command failed with exit code $JQ_EXIT_CODE while trying to parse assets JSON." - echo "Input to jq was: $ASSETS_JSON" - # jq typically prints its own specific error message to stderr, which will also appear in the GitHub Actions log. - # This often means ASSETS_JSON was not a valid JSON array as jq expected (e.g., it was a string, an object, or malformed). - exit 1 # Exit with an error if jq failed. - fi - - # After jq runs successfully (exit code 0), check if the extracted URL_OUTPUT is empty or the string "null". - # jq -r outputs the literal string "null" if the JSON value at the path is actually null. - # An empty string could occur if the field exists but is empty, or if the path was valid but led to an empty value. - if [ -z "$URL_OUTPUT" ] || [ "$URL_OUTPUT" = "null" ]; then - echo "Error: Extracted URL is empty or null, even though the jq command was successful (exit code 0)." - echo "jq output for URL was: '$URL_OUTPUT'" - echo "Input to jq was: $ASSETS_JSON" - echo "This could mean the assets array was empty (e.g., '[]'), or the first asset object (index [0]) did not have a 'browser_download_url' field, or that field's value was explicitly null." - exit 1 # Exit with an error if the URL couldn't be meaningfully extracted. - fi - - # If all checks pass, assign the successfully extracted URL to the URL variable. - URL="$URL_OUTPUT" - - # --- End: Robust URL Extraction --- - - echo "Updating URL to $URL in $META_FILE" - # Update the URL in meta.yaml using sed. - # The '|' character is used as a delimiter for sed to avoid issues with slashes '/' in the URL. - # This command finds "url: ...tar.gz" and replaces the URL part. - sed -i "s|url: .*\.tar\.gz|url: $URL|" "$META_FILE" - - # Get the SHA256 hash from the 'release' job's output SHA256=${{ needs.release.outputs.sha256_hash }} - echo "Updating SHA256 to $SHA256 in $META_FILE" - # Update the SHA256 hash in meta.yaml using sed. - # This command finds "sha256: " and replaces the hex string. - sed -i "s|sha256: [0-9a-fA-F]*|sha256: $SHA256|" "$META_FILE" - + sed -i "s|sha256: [0-9a-f]*|sha256: $SHA256|" recipe/meta.yaml # Displays the differences in meta.yaml after modifications for verification - name: Show changes in meta.yaml From f48671e84ea618a633c719dea54c4f3a43ca3474 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Mon, 16 Jun 2025 14:13:15 -0700 Subject: [PATCH 18/20] chore: update release workflow to automate feedstock PR: change Update meta.yamlv1.2.11 --- .github/workflows/release.yml | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 026d1921e..daba960e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -133,7 +133,6 @@ jobs: # Get the version from the 'check-tag' job's output VERSION=${{ needs.check-tag.outputs.version }} - sed -i "s/{% set version = \".*\" %}/{% set version = \"$VERSION\" %}/" recipe/meta.yaml URL="${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }}" @@ -174,31 +173,7 @@ jobs: # The '-u' flag sets the upstream branch for future pushes/pulls from this local branch. git push -u origin ${CURRENT_BRANCH} - - name: Create Pull Request - # This step uses the 'peter-evans/create-pull-request' action to create a pull request - # in your feedstock repository (harvenstar/sagemaker-code-editor-feedstock). - # - 'token': Uses the PAT from secrets for authentication. - # - 'branch': Explicitly set to the dynamic branch name created earlier. - # - 'base': Specifies the target branch for the pull request (e.g., 'dev' in your fork). - # - 'title': Sets the title of the pull request, including the new version. - # - 'body': Sets the body of the pull request, detailing the automated changes. - # - 'labels': Optionally applies labels to the pull request. - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.PERSONAL_TOKEN }} - # Explicitly specify the head branch for the PR (the dynamic branch created in this job) - branch: ${{ steps.create_branch.outputs.branch_name }} - # The target branch in your harvenstar/sagemaker-code-editor-feedstock fork - base: dev - title: "[Automated] Update recipe to v${{ needs.check-tag.outputs.version }}" - body: | - This is an automated pull request to update the feedstock recipe for sagemaker-code-editor. - - **Version:** ${{ needs.check-tag.outputs.version }} - **Tarball URL:** ${{ fromJSON(needs.release.outputs.assets)[0].browser_download_url }} - **SHA256:** ${{ needs.release.outputs.sha256_hash }} - - This PR was generated automatically by a GitHub Actions workflow. + labels: automated-update, bot # assignees: harvenstar # reviewers: harvenstar From 8c8b7399a9b310c2c2731f459f28012d213e3258 Mon Sep 17 00:00:00 2001 From: Hudson Xing Date: Tue, 17 Jun 2025 14:05:03 -0700 Subject: [PATCH 19/20] chore: update release workflow to automate feedstock PR: change Update meta.yamlv1.2.13 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index daba960e7..045c8a0c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -174,6 +174,6 @@ jobs: git push -u origin ${CURRENT_BRANCH} - labels: automated-update, bot + # labels: automated-update, bot # assignees: harvenstar # reviewers: harvenstar From ddbce2e0fa1485ec9ed278272d7064b0ef1a781d Mon Sep 17 00:00:00 2001 From: Hudson Xing <77495133+harvenstar@users.noreply.github.com> Date: Mon, 30 Jun 2025 12:09:43 -0700 Subject: [PATCH 20/20] Update release.yml Signed-off-by: Hudson Xing <77495133+harvenstar@users.noreply.github.com> --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 045c8a0c0..6424f85f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -175,5 +175,5 @@ jobs: # labels: automated-update, bot - # assignees: harvenstar - # reviewers: harvenstar + # assignees: + # reviewers: