11name : Deploy Public
22
3+ env :
4+ REPO_NAME : fourinsight-api-python
5+ REPO_NAME_SHORT : api
6+ SRC_ROOT_PATH : " ./fourinsight/api"
7+
38on :
49 workflow_dispatch :
510 inputs :
2227 required : true
2328 type : boolean
2429
25- env :
26- REPO_NAME : fourinsight-api-python
27- REPO_NAME_SHORT : api
28-
2930jobs :
3031 build :
3132 runs-on : ubuntu-latest
6061
6162 - name : Replace package version number
6263 run : |
63- filename="./src/$REPO_NAME /__init__.py"
64+ filename="$SRC_ROOT_PATH /__init__.py"
6465 search_pattern="__version__ = \"0.0.1\""
6566 replacement_text="__version__ = \"$VERSION_NUMBER\""
6667 sed -i "s/$search_pattern/$replacement_text/" "$filename"
@@ -109,45 +110,45 @@ jobs:
109110 ./dist/*.whl
110111 ./build/html
111112 retention-days : 1
112-
113+
113114 deploy-test :
114115 if : ${{ inputs.pipeline == 'test' }}
115116 runs-on : ubuntu-latest
116117 needs : build
117118 env :
118119 VERSION_NUMBER : ${{ needs.build.outputs.version_number }}
120+
121+ steps :
122+ - name : Clean up artifacts directory
123+ shell : pwsh
124+ run : Get-ChildItem . | Remove-Item -Recurse -Force
125+
126+ - name : Fetch build artifacts
127+ uses : actions/download-artifact@v3
128+ with :
129+ name : build_artifacts
119130
120- steps :
121- - name : Clean up artifacts directory
122- shell : pwsh
123- run : Get-ChildItem . | Remove-Item -Recurse -Force
124-
125- - name : Fetch build artifacts
126- uses : actions/download-artifact@v3
127- with :
128- name : build_artifacts
131+ - name : Publish package to TestPyPi
132+ uses : pypa/gh-action-pypi-publish@release/v1
133+ with :
134+ user : __token__
135+ password : ${{ secrets.PYPI_TEST_API_KEY }}
136+ repository_url : https://test.pypi.org/legacy/
129137
130- - name : Publish package to TestPyPi
131- uses : pypa/gh-action-pypi-publish@release/v1
132- with :
133- user : __token__
134- password : ${{ secrets.PYPI_TEST_API_KEY }}
135- repository_url : https://test.pypi.org/legacy/
136-
137- - name : Upload documentation to TEST blob storage
138- uses : azure/CLI@v1
139- env :
140- AZURE_STORAGE_CONNECTION_STRING : ${{ secrets.FOURINSIGHTTEST_DOC_BLOB_CONNSTR }}
141- with :
138+ - name : Upload documentation to TEST blob storage
139+ uses : azure/CLI@v1
140+ env :
141+ AZURE_STORAGE_CONNECTION_STRING : ${{ secrets.FOURINSIGHTTEST_DOC_BLOB_CONNSTR }}
142+ with :
142143 inlineScript : |
143144 az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/$VERSION_NUMBER"
144-
145- - name : Upload documentation to TEST blob storage as latest
146- if : ${{ inputs.doc_latest }}
147- uses : azure/CLI@v1
148- env :
149- AZURE_STORAGE_CONNECTION_STRING : ${{ secrets.FOURINSIGHTTEST_DOC_BLOB_CONNSTR }}
150- with :
145+
146+ - name : Upload documentation to TEST blob storage as latest
147+ if : ${{ inputs.doc_latest }}
148+ uses : azure/CLI@v1
149+ env :
150+ AZURE_STORAGE_CONNECTION_STRING : ${{ secrets.FOURINSIGHTTEST_DOC_BLOB_CONNSTR }}
151+ with :
151152 inlineScript : |
152153 az storage blob delete-batch -s "\$web" --pattern "$REPO_NAME_SHORT/python/docs/latest/*"
153154 az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/latest"
@@ -158,37 +159,37 @@ jobs:
158159 needs : build
159160 env :
160161 VERSION_NUMBER : ${{ needs.build.outputs.version_number }}
161-
162- steps :
163- - name : Clean up artifacts directory
164- shell : pwsh
165- run : Get-ChildItem . | Remove-Item -Recurse -Force
166162
167- - name : Fetch build artifacts
168- uses : actions/download-artifact@v3
169- with :
170- name : build_artifacts
163+ steps :
164+ - name : Clean up artifacts directory
165+ shell : pwsh
166+ run : Get-ChildItem . | Remove-Item -Recurse -Force
167+
168+ - name : Fetch build artifacts
169+ uses : actions/download-artifact@v3
170+ with :
171+ name : build_artifacts
171172
172173 - name : Publish package to PyPi
173- uses : pypa/gh-action-pypi-publish@release/v1
174- with :
175- user : __token__
176- password : ${{ secrets.PYPI_PROD_API_KEY }}
177-
178- - name : Upload documentation to PROD blob storage
179- uses : azure/CLI@v1
180- env :
181- AZURE_STORAGE_CONNECTION_STRING : ${{ secrets.FOURINSIGHTPROD_DOC_BLOB_CONNSTR }}
182- with :
183- inlineScript : |
184- az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/$VERSION_NUMBER"
185-
186- - name : Upload documentation to PROD blob storage as latest
187- if : ${{ inputs.doc_latest }}
188- uses : azure/CLI@v1
189- env :
190- AZURE_STORAGE_CONNECTION_STRING : ${{ secrets.FOURINSIGHTPROD_DOC_BLOB_CONNSTR }}
191- with :
192- inlineScript : |
193- az storage blob delete-batch -s "\$web" --pattern "$REPO_NAME_SHORT/python/docs/latest/*"
194- az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/latest"
174+ uses : pypa/gh-action-pypi-publish@release/v1
175+ with :
176+ user : __token__
177+ password : ${{ secrets.PYPI_PROD_API_KEY }}
178+
179+ - name : Upload documentation to PROD blob storage
180+ uses : azure/CLI@v1
181+ env :
182+ AZURE_STORAGE_CONNECTION_STRING : ${{ secrets.FOURINSIGHTPROD_DOC_BLOB_CONNSTR }}
183+ with :
184+ inlineScript : |
185+ az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/$VERSION_NUMBER"
186+
187+ - name : Upload documentation to PROD blob storage as latest
188+ if : ${{ inputs.doc_latest }}
189+ uses : azure/CLI@v1
190+ env :
191+ AZURE_STORAGE_CONNECTION_STRING : ${{ secrets.FOURINSIGHTPROD_DOC_BLOB_CONNSTR }}
192+ with :
193+ inlineScript : |
194+ az storage blob delete-batch -s "\$web" --pattern "$REPO_NAME_SHORT/python/docs/latest/*"
195+ az storage blob upload-batch -d "\$web" -s ./build/html --destination-path "$REPO_NAME_SHORT/python/docs/latest"
0 commit comments