@@ -137,14 +137,14 @@ jobs:
137137 thresholdAll : 0.54
138138
139139 - name : setup java
140- if : github.actor!= 'dependabot[bot]' && (success() || failure())
140+ if : github.actor != 'dependabot[bot]' && (success() || failure())
141141 uses : actions/setup-java@v3
142142 with :
143143 distribution : " corretto"
144144 java-version : " 17"
145145
146146 - name : provision sonar-scanner
147- if : github.actor!= 'dependabot[bot]' && (success() || failure())
147+ if : github.actor != 'dependabot[bot]' && (success() || failure())
148148 run : |
149149 export SONAR_VERSION="4.7.0.2747"
150150 wget -q "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_VERSION}.zip" -O sonar-scanner.zip
@@ -153,7 +153,7 @@ jobs:
153153 scripts/sonar_tests.py
154154
155155 # - name: run sonar scan
156- # if: github.actor!= 'dependabot[bot]' && (success() || failure())
156+ # if: github.actor != 'dependabot[bot]' && (success() || failure())
157157 # run: |
158158 # PATH="$PWD/sonar-scanner/bin:$PATH"
159159 # if [[ "${{ github.event_name }}" == "pull_request" ]]; then
@@ -168,7 +168,7 @@ jobs:
168168
169169
170170 - name : archive reports
171- if : github.actor!= 'dependabot[bot]' && (success() || failure())
171+ if : github.actor != 'dependabot[bot]' && (success() || failure())
172172 uses : actions/upload-artifact@v3
173173 with :
174174 name : reports
@@ -263,3 +263,63 @@ jobs:
263263 echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
264264 echo "${version}"
265265
266+
267+ publish :
268+ runs-on : ubuntu-latest
269+ if : github.repository == 'NHSDigital/nhs-aws-helpers' && github.actor != 'dependabot[bot]'
270+ needs :
271+ - coverage
272+ - lint
273+ - tox
274+ steps :
275+ - name : checkout
276+ uses : actions/checkout@v3
277+ with :
278+ fetch-depth : 0
279+
280+ - name : print branch info
281+ run : |
282+ git branch
283+ echo "GITHUB_HEAD_REF=${GITHUB_HEAD_REF}"
284+ echo "GITHUB_BASE_REF=${GITHUB_BASE_REF}"
285+ git log --oneline -n 10
286+
287+ - name : clean
288+ run : |
289+ git clean -fdx
290+ find . -type f | xargs chmod g+w
291+
292+ - name : merge into base_branch
293+ if : ${{ github.event_name == 'pull_request' }}
294+ run : |
295+ echo base branch "${{ github.base_ref }}"
296+ echo pr branch "${{ github.head_ref }}"
297+ git checkout "${{ github.base_ref }}"
298+ git checkout -b "merging-${{ github.event.number }}"
299+ git merge --ff-only "${{ github.event.pull_request.head.sha }}"
300+
301+ - name : setup python
302+ uses : actions/setup-python@v3
303+ with :
304+ python-version : " 3.8"
305+
306+ - name : setup poetry
307+ uses : abatilo/actions-poetry@v2
308+ with :
309+ poetry-version : 1.5.1
310+
311+ - name : add poetry plugins
312+ run : |
313+ poetry self add "poetry-dynamic-versioning[plugin]"
314+
315+ - name : poetry build
316+ run : |
317+ poetry build --format=wheel
318+
319+ - name : poetry config
320+ run : |
321+ poetry config repositories.testpypi https://test.pypi.org/legacy/
322+ poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}
323+
324+ - name : poetry test publish
325+ run : poetry publish -r testpypi
0 commit comments