Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1b7940f
test: trigger github actions
Jun 5, 2025
e504982
fix: correct YAML comment indentation in release.yml
Jun 5, 2025
89b8949
fix: remove missing update-csp.patch from series
Jun 5, 2025
f1eb7d5
CI: Update Node.js to v24 for fixing release job bug
Jun 10, 2025
5161512
CI: Fix Node.js version and release version in release workflow
Jun 10, 2025
c33c2ba
CI: Fix release version in release workflow
Jun 10, 2025
5b01876
add feedstock module first time
Jun 11, 2025
ec814ae
Update GitHub Actions workflow for automated feedstock PR
Jun 12, 2025
5ade1fc
chore: update release workflow to automate feedstock PR
Jun 16, 2025
ee647c8
chore: update release workflow to automate feedstock PR: remove globa…
Jun 16, 2025
b91f60a
chore: update release workflow to automate feedstock PR: remove globa…
Jun 16, 2025
d081c38
chore: update release workflow to automate feedstock PR: change recip…
Jun 16, 2025
3939512
chore: update release workflow to automate feedstock PR: change Updat…
Jun 16, 2025
adbe5d6
chore: update release workflow to automate feedstock PR: change Updat…
Jun 16, 2025
29cfa94
chore: update release workflow to automate feedstock PR: change Updat…
Jun 16, 2025
35695df
chore: update release workflow to automate feedstock PR: change Updat…
Jun 16, 2025
d0cf52b
chore: update release workflow to automate feedstock PR: change Updat…
Jun 16, 2025
f48671e
chore: update release workflow to automate feedstock PR: change Updat…
Jun 16, 2025
8c8b739
chore: update release workflow to automate feedstock PR: change Updat…
Jun 17, 2025
ddbce2e
Update release.yml
harvenstar Jun 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 88 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -39,63 +46,134 @@ 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
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: 'conda-forge/sagemaker-code-editor-feedstock'
repository: 'harvenstar/sagemaker-code-editor-feedstock'
ref: 'dev'
- name: Create a new dev branch
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: |
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
# 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 }}

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

# Displays the differences in meta.yaml after modifications for verification
- name: Show changes in meta.yaml
run: git diff recipe/meta.yaml

# 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.
# - '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 (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

# 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}"
# 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}


# labels: automated-update, bot
# assignees:
# reviewers:
1 change: 0 additions & 1 deletion patches/series
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
update-csp.patch
sagemaker-extension.diff
disable-online-services.diff
disable-telemetry.diff
Expand Down
Empty file modified scripts/create_code_editor_tarball.sh
100644 → 100755
Empty file.
Loading