Skip to content

Commit 10d7117

Browse files
committed
Extract "Upgrade Git for Windows" to a composite action
Although this is (currently, and in the immediately foreseeable future) only used in one place, it's cumbersome and also something that we've removed and reintroduced before. Making it a composite action may make it reasonable to keep it around for next time it is needed. It had previously been removed based on the idea that it wasn't clear what form it would need to be in if needed again. Now that it is needed again, the current form as well as the form that seems most likely for future needs is to install the latest stable release of Git for Windows (rather than a release candidate, hard coded version, etc.). Note that this should still not be used habitually, as the Git for Windows installation that ships preinstalled on a runner image should be preferred except when insufficient. See GitoxideLabs#1870, GitoxideLabs#1892, GitoxideLabs#1920, and the recent commit that reintroduced this logic, for background.
1 parent b6d2785 commit 10d7117

File tree

2 files changed

+54
-32
lines changed

2 files changed

+54
-32
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: upgrade-git-for-windows
2+
3+
description: Upgrade Git for Windows to the latest stable release
4+
5+
inputs:
6+
arch:
7+
description: >
8+
Target architecture fragment of Git for Windows installer filename
9+
(should be `32-bit`, `64-bit`, or `arm64`)
10+
required: true
11+
12+
runs:
13+
using: composite
14+
15+
steps:
16+
- name: Report version/build of Git in this runner image
17+
run: git version --build-options
18+
shell: pwsh
19+
- name: Download and install latest stable Git for Windows release
20+
env:
21+
ARCH: ${{ inputs.arch }}
22+
GH_TOKEN: ${{ github.token }}
23+
run: |
24+
$workingDir = '~/git-dl'
25+
$repo = 'git-for-windows/git'
26+
$pattern = "Git-*-${Env:ARCH}.exe"
27+
$log = 'setup-log.txt'
28+
# Inno Setup args reference: https://jrsoftware.org/ishelp/index.php?topic=setupcmdline
29+
$arguments = @(
30+
'/VERYSILENT',
31+
'/SUPPRESSMSGBOXES',
32+
'/ALLUSERS',
33+
"/LOG=$log",
34+
'/NORESTART',
35+
'/CLOSEAPPLICATIONS',
36+
'/FORCECLOSEAPPLICATIONS'
37+
)
38+
39+
mkdir $workingDir | Out-Null
40+
cd $workingDir
41+
gh release download --repo $repo --pattern $pattern
42+
$installer = Get-Item $pattern
43+
Start-Process -FilePath $installer -ArgumentList $arguments -NoNewWindow -Wait
44+
45+
Get-Content -Path $log -Tail 50
46+
shell: pwsh
47+
- name: Report version/build of Git after upgrade
48+
run: git version --build-options
49+
shell: pwsh

.github/workflows/ci.yml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -253,40 +253,13 @@ jobs:
253253
runs-on: ${{ matrix.os }}
254254

255255
steps:
256-
- name: Report version/build of Git in this runner image
257-
run: git version --build-options
258-
- name: Upgrade Git for Windows to latest stable release
259-
# TODO(ci): Remove this and related steps once `windows-11-arm` ships a new enough Git.
256+
- name: Upgrade Git for Windows
257+
# TODO(ci): Don't run this step once `windows-11-arm` ships a new enough Git.
260258
# The Windows 11 ARM runner still ships Git 2.48.*, so it remains affected by #1849.
261259
if: matrix.os == 'windows-11-arm'
262-
env:
263-
GH_TOKEN: ${{ github.token }}
264-
run: |
265-
$workingDir = '~/git-dl'
266-
$repo = 'git-for-windows/git'
267-
$pattern = 'Git-*-arm64.exe'
268-
$log = 'setup-log.txt'
269-
# Inno Setup args reference: https://jrsoftware.org/ishelp/index.php?topic=setupcmdline
270-
$arguments = @(
271-
'/VERYSILENT',
272-
'/SUPPRESSMSGBOXES',
273-
'/ALLUSERS',
274-
"/LOG=$log",
275-
'/NORESTART',
276-
'/CLOSEAPPLICATIONS',
277-
'/FORCECLOSEAPPLICATIONS'
278-
)
279-
280-
mkdir $workingDir | Out-Null
281-
cd $workingDir
282-
gh release download --repo $repo --pattern $pattern
283-
$installer = Get-Item $pattern
284-
Start-Process -FilePath $installer -ArgumentList $arguments -NoNewWindow -Wait
285-
286-
Get-Content -Path $log -Tail 50
287-
- name: Report version/build of Git after upgrade
288-
if: matrix.os == 'windows-11-arm'
289-
run: git version --build-options
260+
uses: ./.github/actions/upgrade-git-for-windows
261+
with:
262+
arch: arm64
290263
- uses: actions/checkout@v4
291264
- name: Install rustup
292265
if: matrix.os == 'windows-11-arm'

0 commit comments

Comments
 (0)