Thread info and process visualization #10
Workflow file for this run
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
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: 'Version bump type' | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| if: | | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event.pull_request.merged == true && | |
| (contains(github.event.pull_request.labels.*.name, 'release:major') || | |
| contains(github.event.pull_request.labels.*.name, 'release:minor') || | |
| contains(github.event.pull_request.labels.*.name, 'release:patch'))) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Determine version bump type | |
| id: version_type | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "type=${{ inputs.version_type }}" >> $GITHUB_OUTPUT | |
| elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'release:major') }}" == "true" ]]; then | |
| echo "type=major" >> $GITHUB_OUTPUT | |
| elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'release:minor') }}" == "true" ]]; then | |
| echo "type=minor" >> $GITHUB_OUTPUT | |
| elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'release:patch') }}" == "true" ]]; then | |
| echo "type=patch" >> $GITHUB_OUTPUT | |
| else | |
| echo "type=none" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get current version | |
| id: current_version | |
| run: | | |
| # Try to get the latest tag, default to 0.0.0 if no tags exist | |
| LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
| echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT | |
| # Remove 'v' prefix if present | |
| VERSION=${LATEST_TAG#v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Current version: $VERSION" | |
| - name: Calculate new version | |
| id: new_version | |
| run: | | |
| CURRENT="${{ steps.current_version.outputs.version }}" | |
| TYPE="${{ steps.version_type.outputs.type }}" | |
| # Parse current version | |
| IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT" | |
| MAJOR="${VERSION_PARTS[0]}" | |
| MINOR="${VERSION_PARTS[1]}" | |
| PATCH="${VERSION_PARTS[2]}" | |
| # Bump version based on type | |
| case "$TYPE" in | |
| major) | |
| MAJOR=$((MAJOR + 1)) | |
| MINOR=0 | |
| PATCH=0 | |
| ;; | |
| minor) | |
| MINOR=$((MINOR + 1)) | |
| PATCH=0 | |
| ;; | |
| patch) | |
| PATCH=$((PATCH + 1)) | |
| ;; | |
| *) | |
| echo "No valid version type found" | |
| exit 1 | |
| ;; | |
| esac | |
| NEW_VERSION="$MAJOR.$MINOR.$PATCH" | |
| echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=v$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "New version: $NEW_VERSION" | |
| - name: Create release notes | |
| id: release_notes | |
| run: | | |
| VERSION="${{ steps.new_version.outputs.version }}" | |
| BUMP_TYPE="${{ steps.version_type.outputs.type }}" | |
| # Create release notes | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| # Use PR body for release notes | |
| { | |
| echo "## ${{ github.event.pull_request.title }}" | |
| echo "" | |
| echo "${{ github.event.pull_request.body }}" | |
| echo "" | |
| echo "---" | |
| echo "**Version**: $VERSION | **Type**: $BUMP_TYPE" | |
| } > /tmp/release_notes.md | |
| else | |
| # Manual workflow dispatch | |
| { | |
| echo "Release $VERSION" | |
| echo "" | |
| echo "**Version bump**: $BUMP_TYPE" | |
| } > /tmp/release_notes.md | |
| fi | |
| cat /tmp/release_notes.md | |
| - name: Create and push tag | |
| run: | | |
| TAG="${{ steps.new_version.outputs.tag }}" | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| - name: Create GitHub Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.new_version.outputs.tag }} | |
| release_name: Release ${{ steps.new_version.outputs.tag }} | |
| body_path: /tmp/release_notes.md | |
| draft: false | |
| prerelease: false |