|
42 | 42 | with: |
43 | 43 | fetch-depth: 0 |
44 | 44 |
|
| 45 | + - name: Resolve Micronaut Core checkout cache key |
| 46 | + id: micronaut_core |
| 47 | + run: | |
| 48 | + set -euo pipefail |
| 49 | + sha="$(git ls-remote https://github.com/micronaut-projects/micronaut-core.git refs/heads/cdi-5.1.x | cut -f1)" |
| 50 | + test -n "${sha}" |
| 51 | + echo "sha=${sha}" >> "$GITHUB_OUTPUT" |
| 52 | +
|
| 53 | + - name: Cache Micronaut Core included build checkout |
| 54 | + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 |
| 55 | + with: |
| 56 | + path: checkouts/micronaut-core-cdi |
| 57 | + key: ${{ runner.os }}-micronaut-core-cdi-${{ steps.micronaut_core.outputs.sha }} |
| 58 | + restore-keys: | |
| 59 | + ${{ runner.os }}-micronaut-core-cdi- |
| 60 | +
|
45 | 61 | - name: Setup GraalVM CE |
46 | 62 | uses: graalvm/setup-graalvm@bef4b0e916c7dd079bf60fb95d49139f67e32c5f # v1 |
47 | 63 | with: |
@@ -76,12 +92,37 @@ jobs: |
76 | 92 |
|
77 | 93 | - name: Publish to Github Pages |
78 | 94 | if: success() && github.event_name == 'push' && matrix.java == '25' |
79 | | - uses: micronaut-projects/github-pages-deploy-action@76d63aafbab7108d74e83be4e5b3b0501382e829 # master |
80 | 95 | env: |
81 | | - TARGET_REPOSITORY: ${{ github.repository }} |
82 | | - GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} |
83 | | - BRANCH: gh-pages |
84 | | - FOLDER: build/docs |
| 96 | + GH_TOKEN: ${{ github.token }} |
| 97 | + run: | |
| 98 | + set -euo pipefail |
| 99 | +
|
| 100 | + docs_branch="gh-pages" |
| 101 | + docs_dir="$(mktemp -d)" |
| 102 | + repository_url="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" |
| 103 | +
|
| 104 | + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" |
| 105 | + git config --global user.name "${GITHUB_ACTOR}" |
| 106 | +
|
| 107 | + if git ls-remote --exit-code --heads "${repository_url}" "${docs_branch}" > /dev/null 2>&1; then |
| 108 | + git clone --depth 1 --branch "${docs_branch}" "${repository_url}" "${docs_dir}" |
| 109 | + else |
| 110 | + git init "${docs_dir}" |
| 111 | + git -C "${docs_dir}" checkout -b "${docs_branch}" |
| 112 | + git -C "${docs_dir}" remote add origin "${repository_url}" |
| 113 | + fi |
| 114 | +
|
| 115 | + find "${docs_dir}" -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} + |
| 116 | + cp -R build/docs/. "${docs_dir}/" |
| 117 | + touch "${docs_dir}/.nojekyll" |
| 118 | +
|
| 119 | + git -C "${docs_dir}" add -A |
| 120 | + if git -C "${docs_dir}" diff --cached --quiet; then |
| 121 | + echo "No documentation changes to publish." |
| 122 | + else |
| 123 | + git -C "${docs_dir}" commit -m "Deploy docs for ${GITHUB_SHA}" |
| 124 | + git -C "${docs_dir}" push origin "${docs_branch}" |
| 125 | + fi |
85 | 126 |
|
86 | 127 | - name: Optional cleanup step |
87 | 128 | run: | |
|
0 commit comments