@@ -67,118 +67,9 @@ jobs:
6767 path : dist/
6868 if-no-files-found : error
6969
70- generate-docs-pr :
71- if : github.event_name == 'pull_request'
72- runs-on : ubuntu-20.04
73- steps :
74- - name : Fetch sources
75- uses : actions/checkout@v3
76-
77- - name : Setup Git user and e-mail
78- uses : frequenz-floss/setup-git-user@v1
79-
80- - name : Set up Python
81- uses : actions/setup-python@v4
82- with :
83- python-version : ${{ env.DEFAULT_PYTHON_VERSION }}
84-
85- - name : Install build dependencies
86- run : |
87- python -m pip install -U pip
88- python -m pip install .[docs]
89-
90- - name : Generate the documentation
91- env :
92- MIKE_VERSION : pr-${{ github.event.number }}
93- run : |
94- mike deploy $MIKE_VERSION
95- mike set-default $MIKE_VERSION
96-
97- - name : Upload site
98- uses : actions/upload-artifact@v3
99- with :
100- name : frequenz-channels-python-site
101- path : site/
102- if-no-files-found : error
103-
104- publish-docs :
105- needs : ["test", "build-dist"]
106- if : github.event_name == 'push'
107- runs-on : ubuntu-20.04
108- permissions :
109- contents : write
110- steps :
111- - name : Calculate and check version
112- id : mike-metadata
113- env :
114- REF : ${{ github.ref }}
115- REF_NAME : ${{ github.ref_name }}
116- DEFAULT_BRANCH : ${{ github.event.repository.default_branch }}
117- run : |
118- aliases=
119- version=
120- if test "$REF_NAME" = "$DEFAULT_BRANCH"
121- then
122- version=next
123- # A tag that starts with vX.Y or X.Y
124- elif echo "$REF" | grep -q '^refs/tags' && echo "$REF_NAME" | grep -Pq '^v?\d+\.\d+\.'
125- then
126- if echo "$REF_NAME" | grep -Pq -- "-" # pre-release
127- then
128- echo "::notice title=Documentation was not published::" \
129- "The tag '$REF_NAME' looks like a pre-release."
130- exit 0
131- fi
132- version=$(echo "$REF_NAME" | sed -r 's/^(v?[0-9]+\.[0-9]+)\..*$/\1/') # vX.Y
133- major=$(echo "$REF_NAME" | sed -r 's/^(v?[0-9]+)\..*$/\1/') # vX
134- default_major=$(echo "$DEFAULT_BRANCH" | sed -r 's/^(v?[0-9]+)\..*$/\1/') # vX
135- aliases=$major
136- if test "$major" = "$default_major"
137- then
138- aliases="$aliases latest"
139- fi
140- else
141- echo "::warning title=Documentation was not published::" \
142- "Don't know how to handle '$REF' to make 'mike' version."
143- exit 0
144- fi
145- echo "version=$version" >> $GITHUB_OUTPUT
146- echo "aliases=$aliases" >> $GITHUB_OUTPUT
147-
148- - name : Fetch sources
149- if : steps.mike-metadata.outputs.version
150- uses : actions/checkout@v3
151-
152- - name : Setup Git user and e-mail
153- if : steps.mike-metadata.outputs.version
154- uses : frequenz-floss/setup-git-user@v1
155-
156- - name : Set up Python
157- if : steps.mike-metadata.outputs.version
158- uses : actions/setup-python@v4
159- with :
160- python-version : ${{ env.DEFAULT_PYTHON_VERSION }}
161-
162- - name : Install build dependencies
163- if : steps.mike-metadata.outputs.version
164- run : |
165- python -m pip install -U pip
166- python -m pip install .[docs]
167-
168- - name : Fetch the gh-pages branch
169- if : steps.mike-metadata.outputs.version
170- run : git fetch origin gh-pages --depth=1
171-
172- - name : Publish site
173- if : steps.mike-metadata.outputs.version
174- env :
175- VERSION : ${{ steps.mike-metadata.outputs.version }}
176- ALIASES : ${{ steps.mike-metadata.outputs.aliases }}
177- run : |
178- mike deploy --push --update-aliases "$VERSION" $ALIASES
17970
18071 create-github-release :
181- needs : ["publish-docs "]
72+ needs : ["test", "build-dist "]
18273 # Create a release only on tags creation
18374 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
18475 permissions :
0 commit comments