-
Notifications
You must be signed in to change notification settings - Fork 1.7k
add CI for auto releasing internal packages #6357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
60654db
add CI for auto releasing internal packages
adhami3310 166d47f
fix concurrency issues
adhami3310 8ba4dde
add CI to build packages
adhami3310 409299c
fix pyi hashes
adhami3310 1555bb7
use package at version for release title
adhami3310 bf38be8
fetch tag ref
adhami3310 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| name: Auto-release internal packages | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - "packages/reflex-components-internal/**" | ||
| - "packages/reflex-site-shared/**" | ||
| - ".github/workflows/auto_release_internal.yml" | ||
| workflow_dispatch: | ||
| inputs: | ||
| package: | ||
| description: "Package to release" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - reflex-components-internal | ||
| - reflex-site-shared | ||
|
|
||
| permissions: | ||
| contents: write | ||
| actions: write | ||
|
|
||
| jobs: | ||
| detect: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| packages: ${{ steps.detect.outputs.packages }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 2 | ||
| - id: detect | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| DISPATCH_PACKAGE: ${{ inputs.package }} | ||
| run: | | ||
| set -euo pipefail | ||
| if [ "$EVENT_NAME" = "workflow_dispatch" ]; then | ||
| printf 'packages=["%s"]\n' "$DISPATCH_PACKAGE" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| PACKAGES=() | ||
| for pkg in reflex-components-internal reflex-site-shared; do | ||
| if git diff --name-only HEAD~1 HEAD -- "packages/$pkg/" | grep -q .; then | ||
| PACKAGES+=("\"$pkg\"") | ||
| fi | ||
| done | ||
| JOINED=$(IFS=,; echo "${PACKAGES[*]:-}") | ||
| echo "packages=[$JOINED]" >> "$GITHUB_OUTPUT" | ||
|
|
||
| release: | ||
| needs: detect | ||
| if: needs.detect.outputs.packages != '[]' | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| package: ${{ fromJson(needs.detect.outputs.packages) }} | ||
| fail-fast: false | ||
| concurrency: | ||
| group: release-${{ matrix.package }} | ||
| cancel-in-progress: false | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-tags: true | ||
| fetch-depth: 0 | ||
| - name: Compute next version | ||
| id: version | ||
| env: | ||
| PKG: ${{ matrix.package }} | ||
| run: | | ||
| set -euo pipefail | ||
| LATEST=$(git tag -l "${PKG}-v*" | sed "s/^${PKG}-v//" | sort -V | tail -1) | ||
| if [ -z "$LATEST" ]; then | ||
| NEXT="0.0.1" | ||
| else | ||
| IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST" | ||
| NEXT="${MAJOR}.${MINOR}.$((PATCH + 1))" | ||
| fi | ||
| echo "version=$NEXT" >> "$GITHUB_OUTPUT" | ||
| echo "tag=${PKG}-v${NEXT}" >> "$GITHUB_OUTPUT" | ||
| - name: Create GitHub release (not marked latest) | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| TAG: ${{ steps.version.outputs.tag }} | ||
| PKG: ${{ matrix.package }} | ||
| VERSION: ${{ steps.version.outputs.version }} | ||
| run: | | ||
| set -euo pipefail | ||
| gh release create "$TAG" \ | ||
| --title "$PKG@$VERSION" \ | ||
| --notes "Automated release for $PKG v$VERSION" \ | ||
| --target "$GITHUB_SHA" \ | ||
| --latest=false | ||
| - name: Trigger publish workflow | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| TAG: ${{ steps.version.outputs.tag }} | ||
| run: | | ||
| set -euo pipefail | ||
| gh workflow run publish.yml -f tag="$TAG" | ||
|
adhami3310 marked this conversation as resolved.
adhami3310 marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Build all packages | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| push: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.id || github.sha }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| discover: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| builds: ${{ steps.discover.outputs.builds }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - id: discover | ||
| run: | | ||
| set -euo pipefail | ||
| ENTRIES=('{"name":"reflex","dir":"."}') | ||
| for pkg in packages/*/; do | ||
| name=$(basename "$pkg") | ||
| ENTRIES+=("{\"name\":\"$name\",\"dir\":\"$pkg\"}") | ||
| done | ||
| JOINED=$(IFS=,; echo "${ENTRIES[*]}") | ||
| echo "builds=[$JOINED]" >> "$GITHUB_OUTPUT" | ||
|
|
||
| build: | ||
| needs: discover | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| include: ${{ fromJson(needs.discover.outputs.builds) }} | ||
| fail-fast: false | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-tags: true | ||
| fetch-depth: 0 | ||
| - uses: ./.github/actions/setup_build_env | ||
| with: | ||
| python-version: 3.14 | ||
| run-uv-sync: false | ||
| - name: Build ${{ matrix.name }} | ||
| run: uv build --directory "${{ matrix.dir }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.