-
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (134 loc) · 4.94 KB
/
release.yml
File metadata and controls
166 lines (134 loc) · 4.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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_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 }}