diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f1dfcd26f..bcd155310 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,4 @@ -# See https://docs.github.com/en/actions. + name: Build on: @@ -13,28 +13,88 @@ jobs: build: name: Build runs-on: ubuntu-latest - steps: - # See https://github.com/actions/checkout. - - name: Checkout doc-pt_br - uses: actions/checkout@v3 + + - name: Checkout doc-base + uses: actions/checkout@v7 with: - path: pt_br + repository: php/doc-base + path: doc-base - name: Checkout doc-en - uses: actions/checkout@v3 + uses: actions/checkout@v7 with: repository: php/doc-en path: en - - name: Checkout doc-base - uses: actions/checkout@v3 + # GH actions/checkout, automatically merges, but tends to get stuck in the past. + # See: https://github.com/php/doc-base/pull/329 + + - name: Checkout and merge doc-pt_br + uses: actions/checkout@v7 with: - repository: php/doc-base - path: doc-base + path: pt_br + + - name: Build manual.xml + run: | + php doc-base/configure.php --disable-libxml-check --enable-xml-details --redirect-stderr-to-stdout --with-lang=pt_br 2>&1 + sha1sum doc-base/temp/manual.xml + + + + - name: Alternative path, uses userland merge instead + run: rm -rf pt_br + + # Merge into main/master from *current* names/SHAS. + # + # - github.event.pull_request.base.ref : main/master + # - github.event.pull_request.head.sha : PR head + # + # Does not work: + # - actions/checkout without fetch-depth / fetch-tags + # - git fetch by github.event.pull_request.head.ref + # - git merge --squash --no-commit fails with no ident + # + # TODO: + # - In case of conflict, GH's 'Squash and merge' uses + # --strategy-option=theirs or ours? Probably theirs + # in this case, as we position into master ("here") + # and pulls from feature ("there"). + + - name: Checkout doc-pt_br + uses: actions/checkout@v7 + with: + fetch-depth: 0 + fetch-tags: true + path: pt_br + ref: ${{ github.event.pull_request.head.sha }} + + - name: Squash merge doc-pt_br + run: | + # Squash merge + + cd pt_br + git show-ref -d --head + echo + + # Give the PR detached head a name, to avoid warnings + git branch head-${{ github.event.pull_request.head.sha }} + + # Checkout default branch by name, to always get the current head + git checkout ${{ github.event.pull_request.base.ref }} + echo + + # Squash changes from the PR branch into here (default branch) + # TODO: missing a --strategy-option=theirs on merge --squash ? + git -c user.name="none" -c user.email="none@example.com" merge -q --squash ${{ github.event.pull_request.head.sha }} + git -c user.name="none" -c user.email="none@example.com" commit -m "Squash merge" + echo - - name: Quality Assurance scripts - run: php doc-base/scripts/qa/extensions.xml.php --check + git status --short + git diff --stat + echo - - name: Build documentation for pt_br - run: php doc-base/configure.php --disable-libxml-check --enable-xml-details --redirect-stderr-to-stdout --with-lang=pt_br + - name: Build manual.xml, again + run: | + php doc-base/configure.php --disable-libxml-check --enable-xml-details --redirect-stderr-to-stdout --with-lang=pt_br 2>&1 + sha1sum doc-base/temp/manual.xml