-
Notifications
You must be signed in to change notification settings - Fork 5
89 lines (72 loc) · 2.93 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Docs
on:
push:
branches:
- master
tags:
- "*"
jobs:
antora:
runs-on: ubuntu-latest
if: ${{ contains(github.ref, 'tags') }}
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "Antora via GitHub Actions"
git config user.email "[email protected]"
- name: Parse semver string
id: semver
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ github.ref }}
version_extractor_regex: '\/v(.*)$'
- name: Set variables
run: |
echo "MINOR_VERSION=${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}" >> $GITHUB_ENV
echo "BRANCH_NAME=docs/v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}" >> $GITHUB_ENV
- name: Set branch name for Prerelease
if: ${{ steps.semver.outputs.prerelease != '' }}
run: echo "BRANCH_NAME=${{ env.BRANCH_NAME }}-rc" >> $GITHUB_ENV
- name: Checkout remote branch if exists
run: git checkout ${{ env.BRANCH_NAME }}
continue-on-error: true
- name: Rebase if possible
run: git rebase ${GITHUB_REF##*/} ${{ env.BRANCH_NAME }}
continue-on-error: true
- name: Create new branch if not existing
run: git switch --create ${{ env.BRANCH_NAME }}
continue-on-error: true
- name: Patch Antora file for Release
run: yq eval 'del(.prerelease) | del (.display_version) | .version = "${{ env.MINOR_VERSION }}"' -i docs/antora.yml
if: ${{ steps.semver.outputs.prerelease == '' }}
- name: Patch Antora file for Prerelease
run: yq eval 'del (.display_version) | .version = "${{ env.MINOR_VERSION }}", .prerelease = "-${{ steps.semver.outputs.prerelease }}"' -i docs/antora.yml
if: ${{ steps.semver.outputs.prerelease != '' }}
- name: Commit
run: git commit --all --message "Update version for Antora"
continue-on-error: true
- name: Push
run: git push --atomic --force --set-upstream origin ${{ env.BRANCH_NAME }}
- name: Cleanup prerelease branch if existing
if: ${{ steps.semver.outputs.prerelease == '' }}
run: git push origin --delete ${{ env.BRANCH_NAME }}-rc
continue-on-error: true
gh-pages:
runs-on: ubuntu-latest
# The needs+if combo will cause this job to wait until Antora versioning is done for tags, but still run on master branch
needs: antora
if: always()
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git config user.name "Antora via GitHub Actions"
git config user.email "[email protected]"
- name: Publish documentation
run: make docs-publish