|
13 | 13 | # We only want to test the merge commit (`merge_group` event), the hashes |
14 | 14 | # in the push were already tested by the PR checks |
15 | 15 | - 'gh-readonly-queue/**' |
| 16 | + - 'dependabot/**' |
16 | 17 | workflow_dispatch: |
17 | 18 |
|
18 | 19 | env: |
@@ -307,78 +308,68 @@ jobs: |
307 | 308 | permissions: |
308 | 309 | contents: write |
309 | 310 | steps: |
310 | | - - name: Calculate and check version |
311 | | - id: mike-metadata |
312 | | - env: |
313 | | - REF: ${{ github.ref }} |
314 | | - REF_NAME: ${{ github.ref_name }} |
315 | | - DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} |
316 | | - run: | |
317 | | - aliases= |
318 | | - version= |
319 | | - if test "$REF_NAME" = "$DEFAULT_BRANCH" |
320 | | - then |
321 | | - version=next |
322 | | - # A tag that starts with vX.Y or X.Y |
323 | | - elif echo "$REF" | grep -q '^refs/tags' && echo "$REF_NAME" | grep -Pq '^v?\d+\.\d+\.' |
324 | | - then |
325 | | - if echo "$REF_NAME" | grep -Pq -- "-" # pre-release |
326 | | - then |
327 | | - echo "::notice title=Documentation was not published::" \ |
328 | | - "The tag '$REF_NAME' looks like a pre-release." |
329 | | - exit 0 |
330 | | - fi |
331 | | - version=$(echo "$REF_NAME" | sed -r 's/^(v?[0-9]+\.[0-9]+)\..*$/\1/') # vX.Y |
332 | | - major=$(echo "$REF_NAME" | sed -r 's/^(v?[0-9]+)\..*$/\1/') # vX |
333 | | - default_major=$(echo "$DEFAULT_BRANCH" | sed -r 's/^(v?[0-9]+)\..*$/\1/') # vX |
334 | | - aliases=$major |
335 | | - if test "$major" = "$default_major" |
336 | | - then |
337 | | - aliases="$aliases latest" |
338 | | - fi |
339 | | - else |
340 | | - echo "::warning title=Documentation was not published::" \ |
341 | | - "Don't know how to handle '$REF' to make 'mike' version." |
342 | | - exit 0 |
343 | | - fi |
344 | | - echo "version=$version" >> $GITHUB_OUTPUT |
345 | | - echo "aliases=$aliases" >> $GITHUB_OUTPUT |
346 | | -
|
347 | 311 | - name: Fetch sources |
348 | | - if: steps.mike-metadata.outputs.version |
349 | 312 | uses: actions/checkout@v4 |
350 | 313 | with: |
351 | 314 | submodules: true |
352 | 315 |
|
353 | 316 | - name: Setup Git user and e-mail |
354 | | - if: steps.mike-metadata.outputs.version |
355 | 317 | uses: frequenz-floss/setup-git-user@v2 |
356 | 318 |
|
357 | 319 | - name: Set up Python |
358 | | - if: steps.mike-metadata.outputs.version |
359 | 320 | uses: actions/setup-python@v4 |
360 | 321 | with: |
361 | 322 | python-version: ${{ env.DEFAULT_PYTHON_VERSION }} |
362 | 323 | cache: 'pip' |
363 | 324 |
|
364 | 325 | - name: Install build dependencies |
365 | | - if: steps.mike-metadata.outputs.version |
366 | 326 | run: | |
367 | 327 | python -m pip install -U pip |
368 | 328 | python -m pip install .[dev-mkdocs] |
369 | 329 | pip freeze |
370 | 330 |
|
| 331 | + - name: Calculate and check version |
| 332 | + id: mike-version |
| 333 | + env: |
| 334 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 335 | + GITHUB_REPO: ${{ github.repository }} |
| 336 | + GIT_REF: ${{ github.ref }} |
| 337 | + GIT_SHA: ${{ github.sha }} |
| 338 | + run: | |
| 339 | + python -m frequenz.repo.config.cli.version.mike.info |
| 340 | +
|
371 | 341 | - name: Fetch the gh-pages branch |
372 | | - if: steps.mike-metadata.outputs.version |
| 342 | + if: steps.mike-version.outputs.version |
373 | 343 | run: git fetch origin gh-pages --depth=1 |
374 | 344 |
|
375 | | - - name: Publish site |
376 | | - if: steps.mike-metadata.outputs.version |
| 345 | + - name: Build site |
| 346 | + if: steps.mike-version.outputs.version |
377 | 347 | env: |
378 | | - VERSION: ${{ steps.mike-metadata.outputs.version }} |
379 | | - ALIASES: ${{ steps.mike-metadata.outputs.aliases }} |
| 348 | + VERSION: ${{ steps.mike-version.outputs.version }} |
| 349 | + TITLE: ${{ steps.mike-version.outputs.title }} |
| 350 | + ALIASES: ${{ steps.mike-version.outputs.aliases }} |
| 351 | + # This is not ideal, we need to define all these variables here |
| 352 | + # because we need to calculate all the repository version information |
| 353 | + # to be able to show the correct versions in the documentation when |
| 354 | + # building it. |
| 355 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 356 | + GITHUB_REPO: ${{ github.repository }} |
| 357 | + GIT_REF: ${{ github.ref }} |
| 358 | + GIT_SHA: ${{ github.sha }} |
| 359 | + run: | |
| 360 | + mike deploy --update-aliases --title "$TITLE" "$VERSION" $ALIASES |
| 361 | +
|
| 362 | + - name: Sort site versions |
| 363 | + if: steps.mike-version.outputs.version |
| 364 | + run: | |
| 365 | + git checkout gh-pages |
| 366 | + python -m frequenz.repo.config.cli.version.mike.sort versions.json |
| 367 | + git commit -a -m "Sort versions.json" |
| 368 | +
|
| 369 | + - name: Publish site |
| 370 | + if: steps.mike-version.outputs.version |
380 | 371 | run: | |
381 | | - mike deploy --push --update-aliases "$VERSION" $ALIASES |
| 372 | + git push origin gh-pages |
382 | 373 |
|
383 | 374 | create-github-release: |
384 | 375 | name: Create GitHub release |
|
0 commit comments