3030 required : false
3131
3232jobs :
33- deploy :
33+
34+ run-checks :
3435 runs-on : ubuntu-latest
35- container : python:3.10
3636 env :
3737 GITHUB_TOKEN : ${{ secrets.CI_GITHUB_TOKEN }}
38- outputs :
38+ outputs :
3939 docs-present : ${{ steps.docs.outputs.present }}
40- # permissions: # Uncomment these when trusted publishing supports reusable workflows OPS-185
41- # id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
42- steps :
43- - uses : actions/checkout@v4
4440
45- - name : Install system dependencies
46- run : |
47- apt install gh jq
41+ steps :
4842
49- - name : Install dependencies
50- run : |
51- pip install tox twine
43+ - uses : actions/checkout@v4
5244
5345 - name : Work around git permission issue
5446 run : |
6658 uses : zepben/licence-check-action@main
6759 with :
6860 LC_URL : ${{ secrets.LC_URL }}
69- PATH : src
61+ PATH : ${{ inputs.sourcepath }}
62+
63+ - name : Check if docs present
64+ id : docs
65+ run : |
66+ if [ -d docs ]; then
67+ echo "Docs folder found, will run the build-docs job"
68+ echo "present=yes" >> "${GITHUB_OUTPUT}"
69+ echo "present=yes" >> "${GITHUB_ENV}"
70+ else
71+ echo "Docs folder not found, will skip the build-docs"
72+ fi
73+
74+ - name : Work around git permission issue
75+ run : |
76+ dname=$(echo ${{github.repository}} | cut -d'/' -f2)
77+ git config --global --add safe.directory /__w/$dname/$dname
78+ shell : sh
79+
80+ - name : Check doc build artifacts are ignored
81+ if : ${{ env.present == 'yes' }}
82+ shell : sh {0}
83+ run : |
84+ # Make sure directories are properly ignored
85+ # docs/node_modules
86+ git check-ignore -q docs/site-config/project.json
87+ if [ $? != 0 ]; then
88+ echo "ERROR! Make sure to add 'docs/site-config' to .gitignore"
89+ echo "::error line=1::ERROR! Make sure to add 'docs/site-config' to .gitignore"
90+ exit 1
91+ fi
92+
93+ deploy :
94+ runs-on : ubuntu-latest
95+ container : python:3.10
96+ env :
97+ GITHUB_TOKEN : ${{ secrets.CI_GITHUB_TOKEN }}
98+ outputs :
99+ docs-present : ${{ steps.docs.outputs.present }}
100+ # permissions: # Uncomment these when trusted publishing supports reusable workflows OPS-185
101+ # id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
102+ steps :
103+ - uses : actions/checkout@v4
104+
105+ - name : Install dependencies
106+ run : |
107+ pip install tox twine
108+
109+ - name : Work around git permission issue
110+ run : |
111+ dname=$(echo ${{github.repository}} | cut -d'/' -f2)
112+ git config --global --add safe.directory /__w/$dname/$dname
113+ shell : sh
70114
71115 - name : Create .pypirc
72116 env :
@@ -100,37 +144,6 @@ jobs:
100144 token : ${{ secrets.CODECOV_TOKEN }}
101145 continue-on-error : true
102146
103- - name : Check if docs present
104- id : docs
105- run : |
106- if [ -d docs ]; then
107- echo "Docs folder found, will run the build-docs job"
108- echo "present=yes" >> "${GITHUB_OUTPUT}"
109- echo "present=yes" >> "${GITHUB_ENV}"
110- else
111- echo "Docs folder not found, will skip the build-docs"
112- fi
113-
114- - name : Work around git permission issue
115- run : |
116- dname=$(echo ${{github.repository}} | cut -d'/' -f2)
117- git config --global --add safe.directory /__w/$dname/$dname
118- shell : sh
119-
120- - name : Check doc build artifacts are ignored
121- if : ${{ env.present == 'yes' }}
122- shell : sh {0}
123- run : |
124- # Make sure directories are properly ignored
125- # docs/node_modules
126- git check-ignore -q docs/site-config/project.json
127- if [ $? != 0 ]; then
128- echo "ERROR! Make sure to add 'docs/site-config' to .gitignore"
129- echo "::error line=1::ERROR! Make sure to add 'docs/site-config' to .gitignore"
130- exit 1
131- fi
132-
133-
134147 update-snapshot-version :
135148 needs : [deploy]
136149 container : zepben/pipeline-basic
@@ -155,8 +168,8 @@ jobs:
155168 shell : bash
156169
157170 build-docs :
158- needs : [deploy ]
159- if : ${{ needs.deploy .outputs.docs-present == 'yes' }}
171+ needs : [run-checks ]
172+ if : ${{ needs.run-checks .outputs.docs-present == 'yes' }}
160173 uses : ./.github/workflows/build-docs.yaml
161174 with :
162175 DEPLOY : true
0 commit comments