Skip to content

Commit aeb7a3d

Browse files
committed
Merge branch 'gha-set-output' (#933)
2 parents 4909ba1 + 2b290d5 commit aeb7a3d

File tree

1 file changed

+44
-28
lines changed

1 file changed

+44
-28
lines changed

.github/workflows/ci-cd.yml

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,14 @@ jobs:
8080
'refs/heads/{0}', github.event.repository.default_branch
8181
)
8282
run: >-
83-
print('::set-output name=is-untagged-devel::true')
83+
echo "is-untagged-devel=true" >> "$GITHUB_OUTPUT"
84+
shell: bash
8485
- name: Mark the build as "release request"
8586
id: request-check
8687
if: github.event_name == 'workflow_dispatch'
8788
run: >-
88-
print('::set-output name=release-requested::true')
89+
echo "release-requested=true" >> "$GITHUB_OUTPUT"
90+
shell: bash
8991
- name: Check out src from Git
9092
if: >-
9193
steps.request-check.outputs.release-requested != 'true'
@@ -101,31 +103,32 @@ jobs:
101103
id: calc-cache-key-py
102104
run: |
103105
from hashlib import sha512
106+
from os import environ
104107
from sys import version
105108
hash = sha512(version.encode()).hexdigest()
106-
print(f'::set-output name=py-hash-key::{hash}')
109+
with open(environ['GITHUB_OUTPUT'], mode='a') as github_output:
110+
print(f'py-hash-key={hash}', file=github_output)
107111
- name: >-
108112
Calculate dependency files' combined hash value
109113
for use in the cache key
110114
if: >-
111115
steps.request-check.outputs.release-requested != 'true'
112116
id: calc-cache-key-files
113-
run: |
114-
print(
115-
"::set-output name=files-hash-key::${{
116-
hashFiles(
117+
run: >-
118+
echo "files-hash-key=${{
119+
hashFiles(
117120
'requirements-dev.txt',
118121
'setup.cfg',
119122
'pyproject.toml'
120-
)
121-
}}",
122-
)
123+
)
124+
}}" >> "$GITHUB_OUTPUT"
125+
shell: bash
123126
- name: Get pip cache dir
124127
id: pip-cache-dir
125128
if: >-
126129
steps.request-check.outputs.release-requested != 'true'
127130
run: >-
128-
echo "::set-output name=dir::$(python -m pip cache dir)"
131+
echo "dir=$(python -m pip cache dir)" >> "$GITHUB_OUTPUT"
129132
shell: bash
130133
- name: Set up pip cache
131134
if: >-
@@ -165,35 +168,39 @@ jobs:
165168
if: steps.request-check.outputs.release-requested != 'true'
166169
id: scm-version
167170
run: |
171+
from os import environ
168172
import setuptools_scm
169173
ver = setuptools_scm.get_version(
170174
${{
171175
steps.untagged-check.outputs.is-untagged-devel == 'true'
172176
&& 'local_scheme="no-local-version"' || ''
173177
}}
174178
)
175-
print('::set-output name=dist-version::{ver}'.format(ver=ver))
179+
with open(environ['GITHUB_OUTPUT'], mode='a') as github_output:
180+
print('dist-version={ver}'.format(ver=ver), file=github_output)
176181
- name: Set the target Git tag
177182
id: git-tag
178183
run: >-
179-
print('::set-output name=tag::v${{
184+
echo "tag=v${{
180185
steps.request-check.outputs.release-requested == 'true'
181186
&& github.event.inputs.release-version
182187
|| steps.scm-version.outputs.dist-version
183-
}}')
188+
}}" >> "$GITHUB_OUTPUT"
189+
shell: bash
184190
- name: Set the expected dist artifact names
185191
id: artifact-name
186192
run: |
187-
print('::set-output name=sdist::aiomysql-${{
193+
echo "sdist=aiomysql-${{
188194
steps.request-check.outputs.release-requested == 'true'
189195
&& github.event.inputs.release-version
190196
|| steps.scm-version.outputs.dist-version
191-
}}.tar.gz')
192-
print('::set-output name=wheel::aiomysql-${{
197+
}}.tar.gz" >> "$GITHUB_OUTPUT"
198+
echo "wheel=aiomysql-${{
193199
steps.request-check.outputs.release-requested == 'true'
194200
&& github.event.inputs.release-version
195201
|| steps.scm-version.outputs.dist-version
196-
}}-py3-none-any.whl')
202+
}}-py3-none-any.whl" >> "$GITHUB_OUTPUT"
203+
shell: bash
197204

198205
build:
199206
name: >-
@@ -230,14 +237,16 @@ jobs:
230237
id: calc-cache-key-py
231238
run: |
232239
from hashlib import sha512
240+
from os import environ
233241
from sys import version
234242
hash = sha512(version.encode()).hexdigest()
235-
print(f'::set-output name=py-hash-key::{hash}')
243+
with open(environ['GITHUB_OUTPUT'], mode='a') as github_output:
244+
print(f'py-hash-key={hash}', file=github_output)
236245
shell: python
237246
- name: Get pip cache dir
238247
id: pip-cache-dir
239248
run: >-
240-
echo "::set-output name=dir::$(python -m pip cache dir)"
249+
echo "dir=$(python -m pip cache dir)" >> "$GITHUB_OUTPUT"
241250
- name: Set up pip cache
242251
uses: actions/[email protected]
243252
with:
@@ -334,14 +343,16 @@ jobs:
334343
id: calc-cache-key-py
335344
run: |
336345
from hashlib import sha512
346+
from os import environ
337347
from sys import version
338348
hash = sha512(version.encode()).hexdigest()
339-
print(f'::set-output name=py-hash-key::{hash}')
349+
with open(environ['GITHUB_OUTPUT'], mode='a') as github_output:
350+
print(f'py-hash-key={hash}', file=github_output)
340351
shell: python
341352
- name: Get pip cache dir
342353
id: pip-cache-dir
343354
run: >-
344-
echo "::set-output name=dir::$(python -m pip cache dir)"
355+
echo "dir=$(python -m pip cache dir)" >> "$GITHUB_OUTPUT"
345356
- name: Set up pip cache
346357
uses: actions/[email protected]
347358
with:
@@ -460,12 +471,15 @@ jobs:
460471
- name: Figure out if the interpreter ABI is stable
461472
id: py-abi
462473
run: |
474+
from os import environ
463475
from sys import version_info
464476
is_stable_abi = version_info.releaselevel == 'final'
465-
print(
466-
'::set-output name=is-stable-abi::{is_stable_abi}'.
467-
format(is_stable_abi=str(is_stable_abi).lower())
468-
)
477+
with open(environ['GITHUB_OUTPUT'], mode='a') as github_output:
478+
print(
479+
'is-stable-abi={is_stable_abi}'.
480+
format(is_stable_abi=str(is_stable_abi).lower()),
481+
file=github_output,
482+
)
469483
shell: python
470484

471485
- name: >-
@@ -474,17 +488,19 @@ jobs:
474488
if: fromJSON(steps.py-abi.outputs.is-stable-abi)
475489
id: calc-cache-key-py
476490
run: |
491+
from os import environ
477492
from hashlib import sha512
478493
from sys import version
479494
hash = sha512(version.encode()).hexdigest()
480-
print('::set-output name=py-hash-key::{hash}'.format(hash=hash))
495+
with open(environ['GITHUB_OUTPUT'], mode='a') as github_output:
496+
print('py-hash-key={hash}'.format(hash=hash), file=github_output)
481497
shell: python
482498
483499
- name: Get pip cache dir
484500
if: fromJSON(steps.py-abi.outputs.is-stable-abi)
485501
id: pip-cache-dir
486502
run: >-
487-
echo "::set-output name=dir::$(python -m pip cache dir)"
503+
echo "dir=$(python -m pip cache dir)" >> "$GITHUB_OUTPUT"
488504
489505
- name: Set up pip cache
490506
if: fromJSON(steps.py-abi.outputs.is-stable-abi)

0 commit comments

Comments
 (0)