Skip to content

Start migrating Git for Windows' snapshot builds to GitHub Actions #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/break-pacman-upload-lease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
break-lease:
if: github.event.repository.owner.login == 'git-for-windows'
runs-on: ubuntu-latest
steps:
- name: Clone build-extra
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ env:

jobs:
build:
if: github.event.repository.owner.login == 'git-for-windows'
runs-on: ${{ github.event.inputs.architecture == 'aarch64' && fromJSON('["Windows", "ARM64"]') || 'windows-latest' }}
steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/git-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
test "$ARCHITECTURE" != x86_64 || ARTIFACTS_TO_BUILD="$ARTIFACTS_TO_BUILD nuget"
}
echo "ARTIFACTS_TO_BUILD=$ARTIFACTS_TO_BUILD" >> $GITHUB_ENV
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
echo "PKG_CACHE_KEY=pkg-$GIT_VERSION-$ARCHITECTURE-$TAG_GIT_WORKFLOW_RUN_ID" >> $GITHUB_ENV
- name: Configure user
run:
USER_NAME="${{github.actor}}" &&
Expand Down Expand Up @@ -226,6 +226,7 @@ jobs:
- name: Prepare git-for-windows/git clone with the tag
if: steps.restore-cached-git-pkg.outputs.cache-hit != 'true'
run: |
set -x
if test ! -d /usr/src/MINGW-packages
then
git clone --depth 1 --single-branch -b main \
Expand All @@ -246,7 +247,8 @@ jobs:
then
git fetch origin "refs/tags/$EXISTING_GIT_TAG:refs/tags/$EXISTING_GIT_TAG"
else
git fetch --tags "$GITHUB_WORKSPACE"/bundle-artifacts/git.bundle \
git -c fetch.writeCommitGraph=false fetch --tags --no-recurse-submodules \
"$GITHUB_WORKSPACE"/bundle-artifacts/git.bundle \
$(cat "$GITHUB_WORKSPACE"/bundle-artifacts/next_version)
fi &&
git reset --hard $(cat "$GITHUB_WORKSPACE"/bundle-artifacts/next_version)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/open-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:

jobs:
open-pr:
if: github.event.repository.owner.login == 'git-for-windows'
runs-on: windows-latest
steps:
- name: Determine REPO
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/prepare-embargoed-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: prepare-embargoed-branches
run-name: Prepare branches for embargoed ${{ inputs.mingit-only && 'Min' || '' }}Git ${{ inputs.version }}

on:
workflow_dispatch:
inputs:
version:
description: 'The Git version for which to prepare the branches'
required: true
mingit-only:
description: 'Only prepare the MinGit branches'
default: false
type: boolean

jobs:
prepare-embargoed-branches:
runs-on: ubuntu-latest
steps:
- name: sanity check
if: ${{ github.repository_owner == 'git-for-windows' }}
run: echo "This action is not meant to be run on the Git for Windows repository" >&2 && exit 1
- uses: actions/checkout@v4
- name: identify actor
id: actor
uses: actions/github-script@v7
with:
script: |
const githubApiRequest = require('./github-api-request')
const answer = await githubApiRequest(
console,
'${{ secrets.GITHUB_TOKEN }}',
'GET',
'/users/${{ github.triggering_actor }}'
)
core.setOutput('name', answer.name)
core.setOutput('email', answer.email || '${{ github.triggering_actor }}@users.noreply.github.com')
- name: configure
run: |
USER_NAME="${{ steps.actor.outputs.name }}" &&
USER_EMAIL="${{ steps.actor.outputs.email }}" &&
git config --global user.name "$USER_NAME" &&
git config --global user.email "$USER_EMAIL" &&
git config --global url.https://github.com/${{ github.repository_owner }}.insteadOf \
https://github.com/embargoed-git-for-windows-builds &&
git config --global credential.helper '' &&
git config --global --add credential.helper cache
- name: configure push token
uses: actions/github-script@v7
with:
script: |
const { callGit, getPushAuthorizationHeader } = require('./repository-updates.js')
for (const repo of ['build-extra', 'git', 'git-sdk-32', 'git-sdk-64', 'git-sdk-arm64', 'MINGW-packages']) {
const header = await getPushAuthorizationHeader(
console,
core.setSecret,
${{ secrets.GH_APP_ID }},
${{ toJSON(secrets.GH_APP_PRIVATE_KEY) }},
context.repo.owner,
repo
)
console.log(callGit(['config', '--global', `http.https://github.com/${context.repo.owner}/${repo}.extraHeader`, header]))
}
- name: Prepare embargoed branches
run: sh -x ./prepare-embargoed-branches.sh ${{ inputs.mingit-only && '--mingit ' || ''}}"${{ inputs.version }}"
1 change: 1 addition & 0 deletions .github/workflows/release-git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ env:
jobs:
setup:
runs-on: ubuntu-latest
if: github.event.repository.owner.login == 'git-for-windows'
outputs:
display-version: ${{ steps.bundle-artifacts.outputs.display-version }}
tag-name: ${{ steps.bundle-artifacts.outputs.tag-name }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/updpkgsums.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:

jobs:
updpkgsums:
if: github.event.repository.owner.login == 'git-for-windows'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
Expand Down
Loading