Skip to content

Commit b3beb8a

Browse files
committed
Update version without committing to main
1 parent 0c6b4e5 commit b3beb8a

File tree

4 files changed

+22
-54
lines changed

4 files changed

+22
-54
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,17 @@ jobs:
146146
CUT_RELEASE_VERSION=$(cat .cut_release_version)
147147
echo "CUT_RELEASE_VERSION=${CUT_RELEASE_VERSION}" >> "$GITHUB_ENV"
148148
149-
- name: Update linux/svtminion.sh sha256sum's
150-
run: |
151-
(cd linux && sha256sum svtminion.sh > ../svtminion.sh.sha256)
152-
(cd windows && sha256sum svtminion.ps1 > ../svtminion.ps1.sha256)
153-
git add svtminion.sh.sha256
154-
git add svtminion.ps1.sha256
155-
git commit --allow-empty -am "Update sha256 checksums" || git commit --allow-empty -am "Update sha256 checksums"
149+
- name: Prepare release artifacts
150+
run: |
151+
mkdir -p dist
152+
cp linux/svtminion.sh dist/svtminion.sh
153+
cp windows/svtminion.ps1 dist/svtminion.ps1
154+
# Inject release version into artifact copies (strip leading 'v')
155+
sed -E -i "s/^readonly SCRIPT_VERSION=\".*\"$/readonly SCRIPT_VERSION=\"${CUT_RELEASE_VERSION#v}\"/" dist/svtminion.sh
156+
sed -E -i "s/^\$SCRIPT_VERSION = \".*\"$/\$SCRIPT_VERSION = \"${CUT_RELEASE_VERSION#v}\"/" dist/svtminion.ps1
157+
# Generate checksums for the release artifacts
158+
(cd dist && sha256sum svtminion.sh > ../svtminion.sh.sha256)
159+
(cd dist && sha256sum svtminion.ps1 > ../svtminion.ps1.sha256)
156160
157161
- name: Tag The ${{ needs.update-main.outputs.release-version }} Release
158162
run: |
@@ -169,8 +173,8 @@ jobs:
169173
prerelease: false
170174
generate_release_notes: false
171175
files: |
172-
linux/svtminion.sh
173-
windows/svtminion.ps1
176+
dist/svtminion.sh
177+
dist/svtminion.ps1
174178
svtminion.sh.sha256
175179
svtminion.ps1.sha256
176180
LICENSE
@@ -185,6 +189,7 @@ jobs:
185189
name: Update Release Checksums on Main
186190
runs-on: ubuntu-latest
187191
needs:
192+
- update-main
188193
- publish-release
189194
environment: release
190195
permissions:
@@ -198,17 +203,6 @@ jobs:
198203
repository: ${{ github.repository }}
199204
ssh-key: ${{ secrets.SALT_VMTOOLS_RELEASE_KEY }}
200205

201-
- name: Get linux/svtminion.sh on main branch sha256sum
202-
run: |
203-
echo "SH=$(sha256sum linux/svtminion.sh | awk '{ print $1 }')" >> "$GITHUB_ENV"
204-
echo "VMTS_VERSION=$(bash linux/svtminion.sh --version | awk '{ print $1 }')" >> "$GITHUB_ENV"
205-
206-
- uses: actions/checkout@v6
207-
with:
208-
ref: main
209-
repository: ${{ github.repository }}
210-
ssh-key: ${{ secrets.SALT_VMTOOLS_RELEASE_KEY }}
211-
212206
- name: Configure Git
213207
shell: bash
214208
run: |
@@ -218,8 +212,12 @@ jobs:
218212
git config --global commit.gpgsign false
219213
220214
- name: Update Latest Release on README
215+
shell: bash
221216
run: |
222-
python3 .github/workflows/scripts/update-release-shasum.py ${{ env.VMTS_VERSION }} ${{ env.SH }}
217+
VERSION="${{ needs.update-main.outputs['release-version'] }}"
218+
SH="$(sha256sum linux/svtminion.sh | awk '{ print $1 }')"
219+
echo "Updating README with version '${VERSION}' and sha '${SH}'"
220+
python3 .github/workflows/scripts/update-release-shasum.py "$VERSION" "$SH"
223221
224222
- name: Show Changes
225223
run: |

.github/workflows/scripts/cut-release.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -188,37 +188,7 @@ def main():
188188
+ changelog_file.read_text()
189189
)
190190

191-
# Update Script Version for the bash script
192-
svtminion_script_path = REPO_ROOT / "linux/svtminion.sh"
193-
print(
194-
f"* Updating {svtminion_script_path.relative_to(REPO_ROOT)} ...",
195-
file=sys.stderr,
196-
flush=True,
197-
)
198-
svtminion_script_path.write_text(
199-
re.sub(
200-
r'readonly SCRIPT_VERSION="(.*)"',
201-
f'readonly SCRIPT_VERSION="{options.release_tag.lstrip("v")}"',
202-
svtminion_script_path.read_text(),
203-
)
204-
)
205-
206-
# Update the Script Version for the powershell script
207-
svtminion_script_path = REPO_ROOT / "windows/svtminion.ps1"
208-
print(
209-
f"* Updating {svtminion_script_path.relative_to(REPO_ROOT)} ...",
210-
file=sys.stderr,
211-
flush=True,
212-
)
213-
svtminion_script_path.write_text(
214-
re.sub(
215-
r'\$SCRIPT_VERSION = "(.*)"',
216-
f'$SCRIPT_VERSION = "{options.release_tag.lstrip("v")}"',
217-
svtminion_script_path.read_text(),
218-
)
219-
)
220-
221-
parser.exit(status=0, message="CHANGELOG.md and svtminion.sh updated\n")
191+
parser.exit(status=0, message="CHANGELOG.md and release metadata updated\n")
222192

223193

224194
if __name__ == "__main__":

linux/svtminion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -o pipefail
1919
# using bash for now
2020
# run this script as root, as needed to run Salt
2121

22-
readonly SCRIPT_VERSION="2026.03.13"
22+
readonly SCRIPT_VERSION="SCRIPT_VERSION_REPLACE"
2323

2424
# definitions
2525

windows/svtminion.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ if ($help) {
287287
}
288288

289289
# This value is populated via CICD during build
290-
$SCRIPT_VERSION = "2026.03.13"
290+
$SCRIPT_VERSION = "SCRIPT_VERSION_REPLACE"
291291
if ($Version) {
292292
Write-Host $SCRIPT_VERSION
293293
exit 0

0 commit comments

Comments
 (0)