Release v0.1.0 #3
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 | |
| jobs: | |
| validate: | |
| name: Validate Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Verify build workflow passed | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "Checking if build workflow passed for commit ${{ github.sha }}..." | |
| 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 "The build workflow must pass before creating a release." | |
| exit 1 | |
| fi | |
| echo "Build workflow has passed for this commit" | |
| shell: bash | |
| - 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 | |
| build: | |
| name: Build Release | |
| runs-on: windows-latest | |
| needs: validate | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Update version in Cargo.toml | |
| run: | | |
| $version = "${{ github.event.inputs.version }}" | |
| (Get-Content Cargo.toml) -replace '^version = ".*"', "version = `"$version`"" | Set-Content Cargo.toml | |
| Write-Host "Updated Cargo.toml to version $version" | |
| shell: pwsh | |
| - name: Build release | |
| run: cargo build --release | |
| - name: Create archive | |
| run: | | |
| Compress-Archive -Path target/release/vscwhere.exe -DestinationPath vscwhere-${{ github.event.inputs.version }}-windows-x64.zip | |
| shell: pwsh | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vscwhere-windows-x64 | |
| path: vscwhere-${{ github.event.inputs.version }}-windows-x64.zip | |
| 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 build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: vscwhere-windows-x64 | |
| path: artifacts | |
| - 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" | |
| git tag -a "v$VERSION" -m "Release v$VERSION" | |
| git push origin "v$VERSION" | |
| echo "Created and pushed tag v$VERSION" | |
| shell: bash | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ github.event.inputs.version }} | |
| files: artifacts/vscwhere-${{ github.event.inputs.version }}-windows-x64.zip | |
| body: | | |
| ## What's New in v${{ github.event.inputs.version }} | |
| ${{ needs.changelog.outputs.changelog }} | |
| ## Installation | |
| 1. Download `vscwhere-${{ github.event.inputs.version }}-windows-x64.zip` from the assets below | |
| 2. Extract `vscwhere.exe` to a directory in your PATH | |
| 3. Run `vscwhere -help` to verify installation | |
| ## Usage | |
| ``` | |
| vscwhere List all VS Code installations | |
| vscwhere -prerelease Include Insiders builds | |
| vscwhere -latest -format json Latest install as JSON | |
| vscwhere -property installationPath Just the install paths | |
| ``` | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: false | |
| notify-bluesky: | |
| name: Post to Bluesky | |
| needs: release | |
| uses: CodingWithCalvin/.github/.github/workflows/bluesky-post.yml@main | |
| with: | |
| post_text: | | |
| 🚀 VSCWhere v${{ github.event.inputs.version }} is now available! | |
| A CLI tool to locate #VisualStudioCode installations on #Windows - like vswhere for VS Code. | |
| https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }} | |
| embed_url: https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }} | |
| embed_title: VSCWhere v${{ github.event.inputs.version }} | |
| embed_description: A CLI tool to locate Visual Studio Code installations on Windows | |
| secrets: | |
| BLUESKY_USERNAME: ${{ secrets.BLUESKY_USERNAME }} | |
| BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }} | |
| notify-linkedin: | |
| name: Post to LinkedIn | |
| needs: release | |
| uses: CodingWithCalvin/.github/.github/workflows/linkedin-post.yml@main | |
| with: | |
| post_text: | | |
| 🚀 VSCWhere v${{ github.event.inputs.version }} is now available! | |
| A CLI tool to locate #VisualStudioCode installations on #Windows - like vswhere for VS Code. | |
| https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }} | |
| article_url: https://github.com/${{ github.repository }}/releases/tag/v${{ github.event.inputs.version }} | |
| article_title: VSCWhere v${{ github.event.inputs.version }} | |
| article_description: A CLI tool to locate Visual Studio Code installations on Windows | |
| secrets: | |
| LINKEDIN_ACCESS_TOKEN: ${{ secrets.LINKEDIN_ACCESS_TOKEN }} | |
| LINKEDIN_CLIENT_ID: ${{ secrets.LINKEDIN_CLIENT_ID }} |