Release v0.5.1 #41
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 | |
| run-name: Release v${{ inputs.version }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version number (e.g., 1.0.0, 0.2.1)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write # Required for creating releases and tags | |
| discussions: write # Required for creating announcement discussions | |
| jobs: | |
| validate: | |
| name: Validate Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Verify build workflow passed | |
| run: | | |
| echo "Checking if build workflow passed for commit ${{ github.sha }}..." | |
| # Query for successful build workflow runs for this commit | |
| BUILD_RUNS=$(gh run list \ | |
| --workflow=build.yml \ | |
| --commit=${{ github.sha }} \ | |
| --status=success \ | |
| --json databaseId,conclusion \ | |
| --jq 'length') | |
| if [ "$BUILD_RUNS" -eq 0 ]; then | |
| echo "❌ Error: No successful build workflow run found for commit ${{ github.sha }}" | |
| echo "" | |
| echo "The build workflow must pass before creating a release." | |
| echo "Please ensure the build workflow has completed successfully for this commit." | |
| echo "" | |
| echo "View workflows: https://github.com/${{ github.repository }}/actions" | |
| exit 1 | |
| fi | |
| echo "✓ Build workflow has passed for this commit" | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Validate version format | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Error: Version must be in format X.Y.Z (e.g., 1.0.0)" | |
| exit 1 | |
| fi | |
| echo "✓ Version format is valid: $VERSION" | |
| shell: bash | |
| - name: Validate version is greater than latest release | |
| run: | | |
| NEW_VERSION="${{ github.event.inputs.version }}" | |
| # Get the latest release tag (e.g., v0.0.1) | |
| LATEST_TAG=$(git describe --tags --abbrev=0 --match "v*" 2>/dev/null || echo "") | |
| if [ -z "$LATEST_TAG" ]; then | |
| echo "No previous release tags found" | |
| echo "✓ This will be the first release: v$NEW_VERSION" | |
| exit 0 | |
| fi | |
| # Strip 'v' prefix from tag to get version number | |
| CURRENT_VERSION="${LATEST_TAG#v}" | |
| echo "Latest release: $CURRENT_VERSION (tag: $LATEST_TAG)" | |
| echo "New version: $NEW_VERSION" | |
| # Parse versions into components | |
| IFS='.' read -r curr_major curr_minor curr_patch <<< "$CURRENT_VERSION" | |
| IFS='.' read -r new_major new_minor new_patch <<< "$NEW_VERSION" | |
| # Convert to integers for comparison (10# forces base-10 to handle leading zeros) | |
| curr_major=$((10#$curr_major)) | |
| curr_minor=$((10#$curr_minor)) | |
| curr_patch=$((10#$curr_patch)) | |
| new_major=$((10#$new_major)) | |
| new_minor=$((10#$new_minor)) | |
| new_patch=$((10#$new_patch)) | |
| # Compare versions | |
| if [ $new_major -gt $curr_major ]; then | |
| echo "✓ Version is valid (major version increased: $curr_major → $new_major)" | |
| elif [ $new_major -eq $curr_major ] && [ $new_minor -gt $curr_minor ]; then | |
| echo "✓ Version is valid (minor version increased: $curr_minor → $new_minor)" | |
| elif [ $new_major -eq $curr_major ] && [ $new_minor -eq $curr_minor ] && [ $new_patch -gt $curr_patch ]; then | |
| echo "✓ Version is valid (patch version increased: $curr_patch → $new_patch)" | |
| else | |
| echo "❌ Error: New version ($NEW_VERSION) must be greater than latest release ($CURRENT_VERSION)" | |
| echo "" | |
| echo "Latest release tag: $LATEST_TAG" | |
| echo "Version progression must increase at least one component" | |
| exit 1 | |
| fi | |
| shell: bash | |
| build: | |
| name: Build ${{ matrix.asset_name_suffix }} | |
| runs-on: ${{ matrix.os }} | |
| needs: validate | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: amd64 | |
| asset_name_suffix: linux-amd64 | |
| archive_ext: tar.gz | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: amd64 | |
| asset_name_suffix: macos-amd64 | |
| archive_ext: tar.gz | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: arm64 | |
| asset_name_suffix: macos-arm64 | |
| archive_ext: tar.gz | |
| - os: windows-latest | |
| goos: windows | |
| goarch: amd64 | |
| asset_name_suffix: windows-amd64 | |
| archive_ext: zip | |
| - os: windows-latest | |
| goos: windows | |
| goarch: arm64 | |
| asset_name_suffix: windows-arm64 | |
| archive_ext: zip | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Get dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: | | |
| go test -v ./src/... | |
| shell: bash | |
| - name: Update version in source and scripts | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| # Update version.go (cross-platform sed with backup file) | |
| sed -i.bak 's/var Version = "dev"/var Version = "'"$VERSION"'"/' src/cmd/version.go | |
| rm -f src/cmd/version.go.bak | |
| echo "✓ Updated version.go to version $VERSION" | |
| cat src/cmd/version.go | grep "var Version" | |
| # Update install.sh (inject version WITH "v" prefix for GitHub release URLs) | |
| sed -i.bak 's/DTVEM_RELEASE_VERSION=""/DTVEM_RELEASE_VERSION="v'"$VERSION"'"/' install.sh | |
| rm -f install.sh.bak | |
| echo "✓ Updated install.sh with version v$VERSION" | |
| # Update install.ps1 (inject version WITH "v" prefix for GitHub release URLs) | |
| sed -i.bak 's/\$DTVEM_RELEASE_VERSION = ""/\$DTVEM_RELEASE_VERSION = "v'"$VERSION"'"/' install.ps1 | |
| rm -f install.ps1.bak | |
| echo "✓ Updated install.ps1 with version v$VERSION" | |
| shell: bash | |
| - name: Build main CLI | |
| run: | | |
| go build -v -ldflags="-s -w" -o dist/dtvem${{ matrix.goos == 'windows' && '.exe' || '' }} ./src | |
| shell: bash | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| - name: Build shim executable | |
| run: | | |
| go build -v -ldflags="-s -w" -o dist/dtvem-shim${{ matrix.goos == 'windows' && '.exe' || '' }} ./src/cmd/shim | |
| shell: bash | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| - name: Create archive (Unix) | |
| if: matrix.archive_ext == 'tar.gz' | |
| run: | | |
| cd dist | |
| tar -czf dtvem-${{ github.event.inputs.version }}-${{ matrix.asset_name_suffix }}.${{ matrix.archive_ext }} dtvem* | |
| cd .. | |
| shell: bash | |
| - name: Create archive (Windows) | |
| if: matrix.archive_ext == 'zip' | |
| run: | | |
| cd dist | |
| 7z a dtvem-${{ github.event.inputs.version }}-${{ matrix.asset_name_suffix }}.${{ matrix.archive_ext }} dtvem*.exe | |
| cd .. | |
| shell: bash | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-${{ matrix.asset_name_suffix }} | |
| path: dist/dtvem-${{ github.event.inputs.version }}-${{ matrix.asset_name_suffix }}.${{ matrix.archive_ext }} | |
| retention-days: 1 | |
| - name: Upload install scripts (linux-amd64 only) | |
| if: matrix.asset_name_suffix == 'linux-amd64' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: install-scripts | |
| path: | | |
| install.sh | |
| install.ps1 | |
| retention-days: 1 | |
| changelog: | |
| name: Generate Changelog | |
| needs: build | |
| uses: CodingWithCalvin/.github/.github/workflows/generate-changelog.yml@main | |
| secrets: inherit | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [build, changelog] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Download install scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: install-scripts | |
| path: . | |
| - name: Create and push release tag | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Create tag on current commit (version files are not committed back to main) | |
| # The version updates exist only in the build artifacts, not in source | |
| git tag -a "v$VERSION" -m "Release v$VERSION" | |
| git push origin "v$VERSION" | |
| echo "✓ Created and pushed tag v$VERSION" | |
| echo "" | |
| echo "Note: Version remains 'dev' in main branch source code" | |
| echo "Released binaries and install scripts contain version $VERSION" | |
| shell: bash | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ github.event.inputs.version }} | |
| files: | | |
| artifacts/build-linux-amd64/dtvem-${{ github.event.inputs.version }}-linux-amd64.tar.gz | |
| artifacts/build-macos-amd64/dtvem-${{ github.event.inputs.version }}-macos-amd64.tar.gz | |
| artifacts/build-macos-arm64/dtvem-${{ github.event.inputs.version }}-macos-arm64.tar.gz | |
| artifacts/build-windows-amd64/dtvem-${{ github.event.inputs.version }}-windows-amd64.zip | |
| artifacts/build-windows-arm64/dtvem-${{ github.event.inputs.version }}-windows-arm64.zip | |
| install.sh | |
| install.ps1 | |
| body: | | |
| ## What's New in v${{ github.event.inputs.version }} | |
| ${{ needs.changelog.outputs.changelog }} | |
| ## Installation | |
| ### Quick Install (Recommended) | |
| **macOS / Linux:** | |
| ```bash | |
| curl -fsSL https://github.com/${{ github.repository }}/releases/download/v${{ github.event.inputs.version }}/install.sh | bash | |
| ``` | |
| **Windows (PowerShell):** | |
| ```powershell | |
| irm https://github.com/${{ github.repository }}/releases/download/v${{ github.event.inputs.version }}/install.ps1 | iex | |
| ``` | |
| ### Manual Installation | |
| 1. Download the appropriate archive for your platform from the assets below | |
| 2. Extract the archive | |
| 3. Move binaries to a directory in your PATH | |
| 4. Run `dtvem init` to complete setup | |
| ## Supported Platforms | |
| - ✅ Windows (amd64, arm64) | |
| - ✅ macOS (amd64, arm64/Apple Silicon) | |
| - ✅ Linux (amd64) | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| notify-discussion: | |
| name: Create GitHub Discussion | |
| needs: release | |
| uses: CodingWithCalvin/.github/.github/workflows/github-discussion.yml@main | |
| with: | |
| title: "🎉 dtvem v${{ github.event.inputs.version }} has been released!" | |
| body: | | |
| ## Changes in this release | |
| See the [full changelog](https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }}) for details on what's new in this release. | |
| ## Installation | |
| ### Quick Install (Recommended) | |
| **macOS / Linux:** | |
| ```bash | |
| curl -fsSL https://github.com/${{ github.repository }}/releases/download/v${{ github.event.inputs.version }}/install.sh | bash | |
| ``` | |
| **Windows (PowerShell):** | |
| ```powershell | |
| irm https://github.com/${{ github.repository }}/releases/download/v${{ github.event.inputs.version }}/install.ps1 | iex | |
| ``` | |
| ### Manual Installation | |
| 1. Download the appropriate archive for your platform from the [release page](https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }}) | |
| 2. Extract the archive | |
| 3. Move binaries to a directory in your PATH | |
| 4. Run `dtvem init` to complete setup | |
| ## Supported Platforms | |
| - ✅ Windows (amd64, arm64) | |
| - ✅ macOS (amd64, arm64/Apple Silicon) | |
| - ✅ Linux (amd64) | |
| --- | |
| 📦 [View Release](https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }}) | 📖 [Documentation](https://github.com/${{ github.repository }}) | |
| notify-bluesky: | |
| name: Post to Bluesky | |
| needs: notify-discussion | |
| uses: CodingWithCalvin/.github/.github/workflows/bluesky-post.yml@main | |
| with: | |
| post_text: | | |
| 🚀 #dtvem v${{ github.event.inputs.version }} is now available! | |
| Cross-platform version manager for #Node, #Python, and #Ruby - supports #Windows, #Linux, and #macOS | |
| [Release Notes](https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }}) | |
| [Discussion](${{ needs.notify-discussion.outputs.discussion_url }}) | |
| embed_title: dtvem v${{ github.event.inputs.version }} | |
| embed_description: Cross-platform runtime version manager for Node.js, Python, and Ruby | |
| secrets: | |
| BLUESKY_USERNAME: ${{ secrets.BLUESKY_USERNAME }} | |
| BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }} | |
| notify-x: | |
| name: Post to X | |
| needs: notify-discussion | |
| uses: CodingWithCalvin/.github/.github/workflows/x-post.yml@main | |
| with: | |
| post_text: | | |
| 🚀 #dtvem v${{ github.event.inputs.version }} is now available! | |
| Cross-platform version manager for #Node, #Python, and #Ruby - supports #Windows, #Linux, and #macOS | |
| Release Notes: https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }} | |
| Discussion: ${{ needs.notify-discussion.outputs.discussion_url }} | |
| secrets: | |
| X_CONSUMER_KEY: ${{ secrets.X_CONSUMER_KEY }} | |
| X_CONSUMER_KEY_SECRET: ${{ secrets.X_CONSUMER_KEY_SECRET }} | |
| X_ACCESS_TOKEN: ${{ secrets.X_ACCESS_TOKEN }} | |
| X_ACCESS_TOKEN_SECRET: ${{ secrets.X_ACCESS_TOKEN_SECRET }} | |