Skip to content

Commit

Permalink
git-artifacts: allow specifying repo/ref via workflow_dispatch
Browse files Browse the repository at this point in the history
With this change, users can specify the branch and repository from which
they want to build Git for Windows' artifacts, via the `ref` and
`repository` inputs.

This allows e.g. building `refs/heads/seen` of `git/git` (even if no
`git-artifacts` workflow is configured in that repository), or
`refs/pull/<number>/merge` for a given Pull Request.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Sep 22, 2022
1 parent e5c469b commit c7793b8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/git-artifacts.yml
Expand Up @@ -7,13 +7,19 @@ on:
inputs:
build_only:
description: 'Optionally restrict what artifacts to build'
ref:
description: 'Optionally override which branch to build'
repository:
description: 'Optionally override from where to fetch the specified ref'

env:
GPG_OPTIONS: "--batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
HOME: "${{github.workspace}}\\home"
MSYSTEM: MINGW64
USERPROFILE: "${{github.workspace}}\\home"
BUILD_ONLY: "${{github.event.inputs.build_only}}"
REPOSITORY: "${{github.event.inputs.repository}}"
REF: "${{github.event.inputs.ref}}"

jobs:
bundle-artifacts:
Expand Down Expand Up @@ -70,9 +76,11 @@ jobs:
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "`$@"\n' >/usr/bin/git &&
mkdir -p bundle-artifacts &&
{ test -n \"`$REPOSITORY\" || REPOSITORY='${{github.repository}}'; } &&
{ test -n \"`$REF\" || REF='${{github.ref}}'; } &&
git -c init.defaultBranch=main init --bare &&
git remote add -f origin https://github.com/git-for-windows/git &&
git fetch https://github.com/${{github.repository}} ${{github.ref}}:${{github.ref}} &&
git fetch \"https://github.com/`$REPOSITORY\" \"`$REF:`$REF\" &&
tag_name=\"`$(git describe --match 'v[0-9]*' FETCH_HEAD)-`$(date +%Y%m%d%H%M%S)\" &&
echo \"prerelease-`${tag_name#v}\" >bundle-artifacts/ver &&
Expand Down

0 comments on commit c7793b8

Please sign in to comment.