8000 chore: add support for separate module versioning to CI by matifali · Pull Request #426 · coder/modules · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

chore: add support for separate module versioning to CI #426

Merged
merged 35 commits into from
Apr 22, 2025
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7f130f2
Add support for separate module versioning
matifali Apr 10, 2025
b0069e2
Refactor: Combine version scripts into one versatile tool
matifali Apr 10, 2025
0611ef2
Update CI workflow to use new modules-version.sh tool
matifali Apr 10, 2025
2269e58
Improve CI version check for different workflows
matifali Apr 10, 2025
c6cffc8
Simplify CI version checking
matifali Apr 10, 2025
9bc5419
Remove check-version.sh as it's been replaced by modules-version.sh
matifali Apr 10, 2025
9b89ef4
Improve CI workflow for version checks
matifali Apr 10, 2025
038ef33
Refactor CI workflow for version checks
matifali Apr 10, 2025
0b7a602
Update CONTRIBUTING.md to clarify release process steps
matifali Apr 10, 2025
7d481e8
`fmt`
matifali Apr 10, 2025
d5ecb98
refactor: simplify modules-version script with dry-run and bump-only …
matifali Apr 14, 2025
7c95af8
chore: implement tag-first workflow with automated PRs
matifali Apr 14, 2025
324a383
feat: implement GitHub Action for automatic README updates when tags …
matifali Apr 14, 2025
96657d7
feat: add auto-approve and auto-merge for PR workflow
matifali Apr 14, 2025
1a1dd69
refactor: reuse modules-version.sh in GitHub Action
matifali Apr 14, 2025
4dbe948
feat: add --version parameter for setting exact versions
matifali Apr 14, 2025
bd1703b
refactor: remove environment variable support
matifali Apr 14, 2025
6f2fe83
docs: update release process documentation
matifali Apr 14, 2025
2998721
feat: split scripts into release.sh and update-version.sh
matifali Apr 14, 2025
d63b332
refactor: simplify scripts and workflows
matifali Apr 14, 2025
a6984fb
refactor: further simplify scripts to bare essentials
matifali Apr 14, 2025
0c4f954
feat: use GitHub CLI for PR management
matifali Apr 14, 2025
fb3ae6f
refactor: use cdrci as PR author and auto-approve action
matifali Apr 14, 2025
6d925ca
refactor: remove unnecessary comments and streamline code
matifali Apr 14, 2025
bdd8dba
docs: add helpful comments to scripts and workflow
matifali Apr 14, 2025
3f0615b
fmt
matifali Apr 14, 2025
8200f2d
Remove release script from package.json
matifali Apr 14, 2025
70e5da7
Remove trailing comma in package.json
matifali Apr 14, 2025
e4e5c73
Remove commented-out version check steps in CI
matifali Apr 14, 2025
57fc91f
Simplify and improve GitHub workflow and release scripts
matifali Apr 15, 2025
68f5396
Rename update-version.sh to update_version.sh and improve docs
matifali Apr 15, 2025
8aa9154
Review: refactor scripts
mafredri Apr 17, 2025
974f3f6
Delete .github/workflows/update-readme-version.yaml
matifali Apr 22, 2025
2086134
Update CONTRIBUTING.md
matifali Apr 22, 2025
6b1b617
Merge branch 'main' into separate-versioning
matifali Apr 22, 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
Prev Previous commit
Next Next commit
Simplify CI version checking
- Make version check informational only for PRs
- Add ability to skip check with [skip-version-check] in commit message
- Remove complex logic in favor of simpler workflow
- Ensure developers retain control over versioning
  • Loading branch information
matifali committed Apr 10, 2025
commit c6cffc802a88fcd10768f860a1d81f887f38213a
70 changes: 15 additions & 55 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,60 +54,20 @@ jobs:
- name: Check module versions
shell: bash
run: |
# For PRs: Check that modules with changes have their README versions updated
# For merged commits: Check that versions match tags

# First, identify which modules have changes
echo "Identifying modules with changes..."
CHANGED_MODULES=$(./modules-version.sh | grep "Module " | cut -d: -f1 | sed 's/Module //')

# Add ability to skip version check with a marker in commit message
if [[ "${{ contains(github.event.head_commit.message || '', '[skip-version-check]') }}" == "true" ]]; then
echo "Version check skipped by commit message"
exit 0
fi

# For PRs, just check that the version in README matches what's in modules-version.sh
# This assumes developer has run the script locally to update versions
echo "Checking module versions for changed modules..."
./modules-version.sh

# Skip actual checks when in PR
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "Pull request detected - checking if versions need updating..."

# Extract the base branch (usually main)
BASE_BRANCH="${{ github.base_ref }}"
echo "Base branch: $BASE_BRANCH"

# For each changed module, check if the version in README.md has been incremented
# compared to the latest tag for that module
EXIT_CODE=0
for module in $CHANGED_MODULES; do
echo "Checking module: $module"

# Skip modules without tags
if ! git tag -l "release/$module/v*" | grep -q .; then
echo "Module $module has no previous tags, skipping version check"
continue
fi

# Get latest tag version for this module
LATEST_TAG=$(git tag -l "release/$module/v*" | sort -V | tail -n 1)
TAG_VERSION=$(echo "$LATEST_TAG" | sed "s|release/$module/v||")

# Extract version from README.md in the PR
README_VERSION=$(grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$module/README.md" | head -1 | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' || echo "0.0.0")

echo "Module $module - Latest tag: $TAG_VERSION, PR version: $README_VERSION"

# Compare versions using simple numeric comparison (assumes semantic versioning)
TAG_VERSION_NUM=$(echo "$TAG_VERSION" | sed 's/\.//g')
README_VERSION_NUM=$(echo "$README_VERSION" | sed 's/\.//g')

if [ "$README_VERSION_NUM" -le "$TAG_VERSION_NUM" ]; then
echo "ERROR: Version in $module/README.md ($README_VERSION) must be greater than the latest tag ($TAG_VERSION)"
echo "Please update the version in $module/README.md using one of these methods:"
echo " - Run: ./modules-version.sh --bump=patch $module"
echo " - Run: ./modules-version.sh --bump=minor $module"
echo " - Run: ./modules-version.sh --bump=major $module"
EXIT_CODE=1
else
echo "✓ Version in $module/README.md has been properly incremented"
fi
done

exit $EXIT_CODE
else
# For pushes to main, run the regular check to ensure versions match tags
echo "Push to branch detected - checking versions match tags..."
./modules-version.sh --check
echo "Pull request detected - version check is informational only"
echo "Remember to update versions with ./modules-version.sh if needed"
exit 0
fi
Loading
0