|
| 1 | +name: mingw-w64-x86_64-git |
| 2 | + |
| 3 | +on: |
| 4 | + # This workflow can be triggered manually in the Actions tab, see |
| 5 | + # https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/ |
| 6 | + - workflow_dispatch |
| 7 | + |
| 8 | +env: |
| 9 | + HOME: "${{github.workspace}}\\home" |
| 10 | + MSYSTEM: MINGW64 |
| 11 | + USERPROFILE: "${{github.workspace}}\\home" |
| 12 | + |
| 13 | +jobs: |
| 14 | + bundle-artifacts: |
| 15 | + runs-on: windows-latest |
| 16 | + steps: |
| 17 | + - name: Configure user |
| 18 | + shell: bash |
| 19 | + run: |
| 20 | + USER_NAME="${{github.actor}}" && |
| 21 | + USER_EMAIL="${{github.actor}}@users.noreply.github.com" && |
| 22 | + mkdir "$HOME" && |
| 23 | + git config --global user.name "$USER_NAME" && |
| 24 | + git config --global user.email "$USER_EMAIL" && |
| 25 | + echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >>$GITHUB_ENV |
| 26 | + - name: Download git-sdk-64-build-installers |
| 27 | + shell: bash |
| 28 | + run: | |
| 29 | + # Use Git Bash to download and unpack the artifact |
| 30 | +
|
| 31 | + ## Get artifact |
| 32 | + urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds |
| 33 | + id=$(curl "$urlbase?definitions=29&statusFilter=completed&resultFilter=succeeded&\$top=1" | |
| 34 | + jq -r '.value[0].id') |
| 35 | + download_url=$(curl "$urlbase/$id/artifacts" | |
| 36 | + jq -r '.value[] | select(.name == "git-sdk-64-build-installers").resource.downloadUrl') |
| 37 | +
|
| 38 | + curl -o artifacts.zip "$download_url" |
| 39 | +
|
| 40 | + ## Unpack artifact |
| 41 | + unzip artifacts.zip |
| 42 | + - name: Clone build-extra |
| 43 | + shell: bash |
| 44 | + run: | |
| 45 | + d=git-sdk-64-build-installers/usr/src/build-extra && |
| 46 | + git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d |
| 47 | + - name: Generate bundle artifacts |
| 48 | + shell: powershell |
| 49 | + run: | |
| 50 | + & .\git-sdk-64-build-installers\git-cmd.exe --command=usr\bin\bash.exe -lc @" |
| 51 | + printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "`$@"\n' >/usr/bin/git && |
| 52 | + mkdir -p bundle-artifacts && |
| 53 | +
|
| 54 | + git -c init.defaultBranch=main init --bare && |
| 55 | + git remote add -f origin https://github.com/git-for-windows/git && |
| 56 | + git fetch https://github.com/${{github.repository}} ${{github.ref}}:${{github.ref}} && |
| 57 | +
|
| 58 | + tag_name=\"`$(git describe --match 'v[0-9]*' FETCH_HEAD)-`$(date +%Y%m%d%H%M%S)\" && |
| 59 | + echo \"prerelease-`${tag_name#v}\" >bundle-artifacts/ver && |
| 60 | + echo \"`${tag_name#v}\" >bundle-artifacts/display_version && |
| 61 | + echo \"`$tag_name\" >bundle-artifacts/next_version && |
| 62 | + git tag -m \"Snapshot build\" \"`$tag_name\" FETCH_HEAD && |
| 63 | + git bundle create bundle-artifacts/git.bundle origin/main..\"`$tag_name\" && |
| 64 | +
|
| 65 | + sh -x /usr/src/build-extra/please.sh mention feature \"Snapshot of `$(git show -s --pretty='tformat:%h (%s, %ad)' --date=short FETCH_HEAD)\" && |
| 66 | + git -C /usr/src/build-extra bundle create \"`$PWD/bundle-artifacts/build-extra.bundle\" origin/main..main |
| 67 | + "@ |
| 68 | + - name: 'Publish Pipeline Artifact: bundle-artifacts' |
| 69 | + uses: actions/upload-artifact@v1 |
| 70 | + with: |
| 71 | + name: bundle-artifacts |
| 72 | + path: bundle-artifacts |
| 73 | + pkg-x86_64: |
| 74 | + runs-on: windows-latest |
| 75 | + needs: bundle-artifacts |
| 76 | + steps: |
| 77 | + - name: Configure user |
| 78 | + shell: bash |
| 79 | + run: |
| 80 | + USER_NAME="${{github.actor}}" && |
| 81 | + USER_EMAIL="${{github.actor}}@users.noreply.github.com" && |
| 82 | + mkdir "$HOME" && |
| 83 | + git config --global user.name "$USER_NAME" && |
| 84 | + git config --global user.email "$USER_EMAIL" && |
| 85 | + echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >>$GITHUB_ENV |
| 86 | + - name: Download git-sdk-64-makepkg-git |
| 87 | + shell: bash |
| 88 | + run: | |
| 89 | + # Use Git Bash to download and unpack the artifact |
| 90 | +
|
| 91 | + ## Get artifact |
| 92 | + urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds |
| 93 | + id=${{ needs.bundle-artifacts.outputs.latest-sdk64-extra-build-id }} |
| 94 | + download_url="$(curl "$urlbase/$id/artifacts" | |
| 95 | + jq -r '.value[] | select(.name == "git-sdk-64-makepkg-git").resource.downloadUrl')" |
| 96 | +
|
| 97 | + curl -o artifacts.zip "$download_url" |
| 98 | +
|
| 99 | + ## Unpack artifact |
| 100 | + unzip artifacts.zip |
| 101 | + - name: Download bundle-artifacts |
| 102 | + uses: actions/download-artifact@v1 |
| 103 | + with: |
| 104 | + name: bundle-artifacts |
| 105 | + path: bundle-artifacts |
| 106 | + - name: Clone and update build-extra |
| 107 | + shell: bash |
| 108 | + run: | |
| 109 | + d=git-sdk-64-makepkg-git/usr/src/build-extra && |
| 110 | + git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d && |
| 111 | + git -C $d pull "$PWD"/bundle-artifacts/build-extra.bundle main |
| 112 | + - name: Check out git/git |
| 113 | + shell: bash |
| 114 | + run: | |
| 115 | + git -c init.defaultBranch=main init && |
| 116 | + git remote add -f origin https://github.com/git-for-windows/git && |
| 117 | + git fetch --tags bundle-artifacts/git.bundle $(cat bundle-artifacts/next_version) && |
| 118 | + git reset --hard $(cat bundle-artifacts/next_version) |
| 119 | + - name: Build mingw-w64-x86_64-git |
| 120 | + shell: powershell |
| 121 | + run: | |
| 122 | + & git-sdk-64-makepkg-git\usr\bin\sh.exe -lc @" |
| 123 | + set -x |
| 124 | + # Let `cv2pdb` find the DLLs |
| 125 | + PATH=\"`$PATH:/c/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/IDE/:/C/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64\" |
| 126 | + type -p mspdb140.dll || exit 1 |
| 127 | + sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-64-bit --build-src-pkg -o artifacts HEAD && |
| 128 | + cp bundle-artifacts/ver artifacts/ && |
| 129 | +
|
| 130 | + b=`$PWD/artifacts && |
| 131 | + version=`$(cat bundle-artifacts/next_version) && |
| 132 | + (cd /usr/src/MINGW-packages/mingw-w64-git && |
| 133 | + cp PKGBUILD.`$version PKGBUILD && |
| 134 | + git commit -s -m \"mingw-w64-git: new version (`$version)\" PKGBUILD && |
| 135 | + git bundle create \"`$b\"/MINGW-packages.bundle origin/main..main) |
| 136 | + "@ |
| 137 | + - name: Publish mingw-w64-x86_64-git |
| 138 | + uses: actions/upload-artifact@v1 |
| 139 | + with: |
| 140 | + name: pkg-x86_64 |
| 141 | + path: artifacts |
0 commit comments