diff --git a/.github/workflows/rebuild-alpha16.7.yml b/.github/workflows/rebuild-alpha16.7.yml new file mode 100644 index 0000000..e70cce7 --- /dev/null +++ b/.github/workflows/rebuild-alpha16.7.yml @@ -0,0 +1,122 @@ +name: Rebuild Alpha 16.7 source + +on: + pull_request: + branches: [main] + types: [opened, synchronize, reopened] + +permissions: + contents: write + +jobs: + rebuild: + if: github.head_ref == 'release/v2.1.0.0-alpha16.7' + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v4 + with: + ref: release/v2.1.0.0-alpha16.7 + fetch-depth: 0 + + - name: Recover and verify Alpha 16.7 + shell: bash + run: | + set -euo pipefail + recovered=/tmp/cco-recovered + source=/tmp/cco-source + rm -rf "$recovered" "$source" + mkdir -p "$recovered" "$source/gui" "$source/l10n" "$source/scripts/gui" "$source/modSettings/FS25_CropControlOverride" + cp icon_CropControlOverride.dds "$source/icon_CropControlOverride.dds" + + fetch_blob() { + local sha="$1" out="$2" + curl --fail --silent --show-error \ + -H "Authorization: Bearer $GH_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/$GITHUB_REPOSITORY/git/blobs/$sha" \ + | jq -r '.content' | tr -d '\r\n' | base64 --decode > "$out" + test "$(git hash-object "$out")" = "$sha" + } + + blobs=( + c4f41ea219ea2bf1465119f3647c5415ac65a0a4 + 17967bc6b3543bd0bc8c5a2e66d5e015feff4a1b + 8236f825bc47a0d4b465ea3f34d11430565864fb + f4da1416db70ba51b91c4443d0895d58e0535aa4 + 3d68b7e4a4578eaeccc396a6cf0e7f18794d137f + c6c217a4dee2c05aabd0b8172015252f5bb0d32d + 276cda3e2e31fc73c7263b1cec0cdf8c5ee7ed8e + 6615d70c68a8e5a92c520e5474e0585b38a2d25a + 1265d627f383e0b64e9602212d189d765588d3e8 + 6df7ce36da5abeb1198831002fc6bf097f782c82 + 1bcee703a689d1eb1ddca9e2c3f512560b1ee433 + 381c02191f3d46f3d94c6b8726a0d8aa98d5cc6c + e02e5f6cfef13cd01019d6d89065cc8dc10000f2 + 296ef6192062746d84ae55e7f8b12a67d0dd16b4 + 486aa59d0eb54cf6e1c4d1f0fdcebbf599b82bd1 + 9fb9415111c7d5c22121a650f922afa7673fe30b + 65cdb24a6677026a5c398f2bbc927f3fdab8e4a4 + a96f299e8677fdd4184b463ad970d472947920ff + 2e202c445614817fd2dd6724266025f3dbcd5b60 + db3d550fca76e728c1d6492e6778afbe43060a5f + ) + + classify() { + local file="$1" dest="" + if grep -aq '2.1.0.0' "$source/modDesc.xml" + grep -q 'SimGamerJen' "$source/modDesc.xml" + grep -q 'Contributor acknowledgement: Hyper138' "$source/modDesc.xml" + grep -q 'VERSION = "2.1.0.0-alpha.16.7"' "$source/scripts/CropControlOverride.lua" + grep -q 'cco_calendar_legend_planting' "$source/l10n/l10n_en.xml" + + rm -rf gui l10n scripts modSettings + rm -f modDesc.xml icon_CropControlOverride.dds README.md RELEASE_NOTES_ALPHA16.7.md + cp -a "$source"/* . + rm -rf .github .release + + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + git add -A + git commit -m 'Rebuild Alpha 16.7 source from verified objects' + git push origin HEAD:release/v2.1.0.0-alpha16.7