Skip to content

Commit 2cabd52

Browse files
authored
Merge pull request #109 from git-for-windows/snapshot-builds
Start migrating Git for Windows' snapshot builds to GitHub Actions
2 parents 3dce3f0 + 115a75f commit 2cabd52

11 files changed

+536
-12
lines changed

.github/workflows/break-pacman-upload-lease.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
jobs:
88
break-lease:
9+
if: github.event.repository.owner.login == 'git-for-windows'
910
runs-on: ubuntu-latest
1011
steps:
1112
- name: Clone build-extra

.github/workflows/build-and-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ env:
3636

3737
jobs:
3838
build:
39+
if: github.event.repository.owner.login == 'git-for-windows'
3940
runs-on: ${{ github.event.inputs.architecture == 'aarch64' && fromJSON('["Windows", "ARM64"]') || 'windows-latest' }}
4041
steps:
4142
- uses: actions/checkout@v4

.github/workflows/git-artifacts.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172
test "$ARCHITECTURE" != x86_64 || ARTIFACTS_TO_BUILD="$ARTIFACTS_TO_BUILD nuget"
173173
}
174174
echo "ARTIFACTS_TO_BUILD=$ARTIFACTS_TO_BUILD" >> $GITHUB_ENV
175-
echo "PKG_CACHE_KEY=pkg-$GIT_VERSION$(test v2.48.0-rc1.windows.1 != "$GIT_VERSION" || echo "-try2")-$ARCHITECTURE-$TAG_GIT_WORKFLOW_RUN_ID" >> $GITHUB_ENV
175+
echo "PKG_CACHE_KEY=pkg-$GIT_VERSION-$ARCHITECTURE-$TAG_GIT_WORKFLOW_RUN_ID" >> $GITHUB_ENV
176176
- name: Configure user
177177
run:
178178
USER_NAME="${{github.actor}}" &&
@@ -226,6 +226,7 @@ jobs:
226226
- name: Prepare git-for-windows/git clone with the tag
227227
if: steps.restore-cached-git-pkg.outputs.cache-hit != 'true'
228228
run: |
229+
set -x
229230
if test ! -d /usr/src/MINGW-packages
230231
then
231232
git clone --depth 1 --single-branch -b main \
@@ -246,7 +247,8 @@ jobs:
246247
then
247248
git fetch origin "refs/tags/$EXISTING_GIT_TAG:refs/tags/$EXISTING_GIT_TAG"
248249
else
249-
git fetch --tags "$GITHUB_WORKSPACE"/bundle-artifacts/git.bundle \
250+
git -c fetch.writeCommitGraph=false fetch --tags --no-recurse-submodules \
251+
"$GITHUB_WORKSPACE"/bundle-artifacts/git.bundle \
250252
$(cat "$GITHUB_WORKSPACE"/bundle-artifacts/next_version)
251253
fi &&
252254
git reset --hard $(cat "$GITHUB_WORKSPACE"/bundle-artifacts/next_version)

.github/workflows/open-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ env:
2424

2525
jobs:
2626
open-pr:
27+
if: github.event.repository.owner.login == 'git-for-windows'
2728
runs-on: windows-latest
2829
steps:
2930
- name: Determine REPO
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: prepare-embargoed-branches
2+
run-name: Prepare branches for embargoed ${{ inputs.mingit-only && 'Min' || '' }}Git ${{ inputs.version }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'The Git version for which to prepare the branches'
9+
required: true
10+
mingit-only:
11+
description: 'Only prepare the MinGit branches'
12+
default: false
13+
type: boolean
14+
15+
jobs:
16+
prepare-embargoed-branches:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: sanity check
20+
if: ${{ github.repository_owner == 'git-for-windows' }}
21+
run: echo "This action is not meant to be run on the Git for Windows repository" >&2 && exit 1
22+
- uses: actions/checkout@v4
23+
- name: identify actor
24+
id: actor
25+
uses: actions/github-script@v7
26+
with:
27+
script: |
28+
const githubApiRequest = require('./github-api-request')
29+
const answer = await githubApiRequest(
30+
console,
31+
'${{ secrets.GITHUB_TOKEN }}',
32+
'GET',
33+
'/users/${{ github.triggering_actor }}'
34+
)
35+
core.setOutput('name', answer.name)
36+
core.setOutput('email', answer.email || '${{ github.triggering_actor }}@users.noreply.github.com')
37+
- name: configure
38+
run: |
39+
USER_NAME="${{ steps.actor.outputs.name }}" &&
40+
USER_EMAIL="${{ steps.actor.outputs.email }}" &&
41+
git config --global user.name "$USER_NAME" &&
42+
git config --global user.email "$USER_EMAIL" &&
43+
git config --global url.https://github.com/${{ github.repository_owner }}.insteadOf \
44+
https://github.com/embargoed-git-for-windows-builds &&
45+
git config --global credential.helper '' &&
46+
git config --global --add credential.helper cache
47+
- name: configure push token
48+
uses: actions/github-script@v7
49+
with:
50+
script: |
51+
const { callGit, getPushAuthorizationHeader } = require('./repository-updates.js')
52+
for (const repo of ['build-extra', 'git', 'git-sdk-32', 'git-sdk-64', 'git-sdk-arm64', 'MINGW-packages']) {
53+
const header = await getPushAuthorizationHeader(
54+
console,
55+
core.setSecret,
56+
${{ secrets.GH_APP_ID }},
57+
${{ toJSON(secrets.GH_APP_PRIVATE_KEY) }},
58+
context.repo.owner,
59+
repo
60+
)
61+
console.log(callGit(['config', '--global', `http.https://github.com/${context.repo.owner}/${repo}.extraHeader`, header]))
62+
}
63+
- name: Prepare embargoed branches
64+
run: sh -x ./prepare-embargoed-branches.sh ${{ inputs.mingit-only && '--mingit ' || ''}}"${{ inputs.version }}"

.github/workflows/release-git.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ env:
2525
jobs:
2626
setup:
2727
runs-on: ubuntu-latest
28+
if: github.event.repository.owner.login == 'git-for-windows'
2829
outputs:
2930
display-version: ${{ steps.bundle-artifacts.outputs.display-version }}
3031
tag-name: ${{ steps.bundle-artifacts.outputs.tag-name }}

.github/workflows/updpkgsums.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ env:
2424

2525
jobs:
2626
updpkgsums:
27+
if: github.event.repository.owner.login == 'git-for-windows'
2728
runs-on: windows-latest
2829
steps:
2930
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)