You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
234 lines
8.3 KiB
234 lines
8.3 KiB
name: Create Release |
|
|
|
concurrency: |
|
group: ${{ github.workflow }}-${{ github.ref }} |
|
cancel-in-progress: true |
|
|
|
on: |
|
workflow_dispatch: |
|
push: |
|
branches: |
|
- main |
|
paths-ignore: |
|
- '**/*.md' |
|
|
|
permissions: |
|
contents: write |
|
pull-requests: write |
|
actions: read |
|
pages: write |
|
id-token: write |
|
|
|
env: |
|
APP_NAME: pyTermTk |
|
|
|
jobs: |
|
release-please: |
|
# runs-on: ubuntu-latest |
|
runs-on: self-hosted |
|
|
|
outputs: |
|
rp_out: ${{ toJson(steps.release-please.outputs) }} |
|
steps: |
|
- uses: actions/checkout@v4 |
|
with: |
|
ref: ${{ github.sha }} |
|
- name: Trust git directory |
|
run: git config --global --add safe.directory $GITHUB_WORKSPACE |
|
- uses: googleapis/release-please-action@v4 |
|
timeout-minutes: 15 |
|
id: release-please |
|
with: |
|
token: ${{ secrets.GH_PAT_TOKEN }} |
|
config-file: .release-please-config.json |
|
manifest-file: .release-please-manifest.json |
|
- name: Print outputs |
|
shell: bash |
|
env: |
|
OUTPUTS: ${{ toJSON(steps.release-please.outputs) }} |
|
run: | |
|
echo OUTPUTS: "$OUTPUTS" |
|
- name: Update Version |
|
if: ${{ steps.release-please.outputs.prs_created == 'true'}} |
|
shell: bash |
|
env: |
|
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }} |
|
run: | |
|
echo '::group::Setup Git' |
|
git config --global user.name 'Eugenio Parodi - Action' |
|
git config --global user.email 'ceccopierangioliegenio@googlemail.com' |
|
git clone \ |
|
-b ${{ fromJson(steps.release-please.outputs.pr).headBranchName }} \ |
|
https://${GITHUB_TOKEN}@github.com/ceccopierangiolieugenio/pyTermTk.git \ |
|
pyTermTk.new |
|
echo '::endgroup::' |
|
|
|
cd pyTermTk.new |
|
|
|
echo '::group::Retrieve the Versions' |
|
# Update version in the project |
|
_VERSION_TTK=$(jq -r '.["libs/pyTermTk" ]' .release-please-manifest.json) |
|
_VERSION_DPT=$(jq -r '.["apps/dumbPaintTool"]' .release-please-manifest.json) |
|
_VERSION_T_D=$(jq -r '.["apps/ttkDesigner" ]' .release-please-manifest.json) |
|
_VERSION_KOD=$(jq -r '.["apps/ttkode" ]' .release-please-manifest.json) |
|
_NAME_TTK=$(jq -r '.packages["libs/pyTermTk" ]["package-name"]' .release-please-config.json) |
|
_NAME_DPT=$(jq -r '.packages["apps/dumbPaintTool"]["package-name"]' .release-please-config.json) |
|
_NAME_T_D=$(jq -r '.packages["apps/ttkDesigner" ]["package-name"]' .release-please-config.json) |
|
_NAME_KOD=$(jq -r '.packages["apps/ttkode" ]["package-name"]' .release-please-config.json) |
|
|
|
echo "Version ${_NAME_TTK}: ${_VERSION_TTK}" |
|
echo "Version ${_NAME_DPT}: ${_VERSION_DPT}" |
|
echo "Version ${_NAME_T_D}: ${_VERSION_T_D}" |
|
echo "Version ${_NAME_KOD}: ${_VERSION_KOD}" |
|
echo '::endgroup::' |
|
|
|
echo '::group::Update the Versions' |
|
sed -i \ |
|
"s|__version__:str.*|__version__:str = '${_VERSION_TTK}'|" \ |
|
libs/pyTermTk/TermTk/__init__.py |
|
|
|
if grep -q "${_NAME_DPT}: ${_VERSION_DPT}" <<< ' ${{ steps.release-please.outputs.pr }}' ; then |
|
sed -i \ |
|
"s|__version__:str.*|__version__:str = '${_VERSION_T_D}'|" \ |
|
apps/ttkDesigner/ttkDesigner/__init__.py |
|
sed "s|'pyTermTk *>=[^']*'|'pyTermTk>=${_VERSION_TTK}'|" -i apps/dumbPaintTool/pyproject.toml |
|
fi |
|
if grep -q "${_NAME_T_D}: ${_VERSION_T_D}" <<< ' ${{ steps.release-please.outputs.pr }}' ; then |
|
sed -i \ |
|
"s|__version__:str.*|__version__:str = '${_VERSION_DPT}'|" \ |
|
apps/dumbPaintTool/dumbPaintTool/__init__.py |
|
sed "s|'pyTermTk *>=[^']*'|'pyTermTk>=${_VERSION_TTK}'|" -i apps/ttkDesigner/pyproject.toml |
|
fi |
|
if grep -q "${_NAME_KOD}: ${_VERSION_KOD}" <<< ' ${{ steps.release-please.outputs.pr }}' ; then |
|
sed -i \ |
|
"s|__version__:str.*|__version__:str = '${_VERSION_KOD}'|" \ |
|
apps/ttkode/ttkode/__init__.py |
|
sed "s|'pyTermTk *>=[^']*'|'pyTermTk>=${_VERSION_TTK}'|" -i apps/ttkode/pyproject.toml |
|
fi |
|
cp libs/pyTermTk/CHANGELOG.md CHANGELOG.md |
|
echo '::endgroup::' |
|
|
|
echo '::group::Push the Versions' |
|
git add \ |
|
apps/*/*/__init__.py \ |
|
libs/pyTermTk/TermTk/__init__.py \ |
|
CHANGELOG.md |
|
find . -name pyproject.toml xargs git add |
|
|
|
git commit -m "chore: updated TermTk and apps to versions to ${_VERSION_TTK}, ${_VERSION_DPT}, ${_VERSION_T_D} ${_VERSION_KOD}" |
|
git push |
|
echo '::endgroup::' |
|
|
|
pyTermTk-deploy-artifacts: |
|
if: ${{ fromJson(needs.release-please.outputs.rp_out)['libs/pyTermTk--release_created'] }} |
|
runs-on: ubuntu-latest |
|
name: Deploy pyTermTk to github release |
|
needs: release-please |
|
steps: |
|
- uses: actions/checkout@v4 |
|
with: |
|
ref: ${{ github.sha }} |
|
- name: Create Artifacts |
|
id: create-artifacts |
|
shell: bash |
|
run: | |
|
# _TMP=$(mktmp) |
|
_TMP=tmp |
|
echo "artifacts_dir=${_TMP}" >> $GITHUB_OUTPUT |
|
mkdir -p ${_TMP} |
|
find libs/pyTermTk/TermTk -name "*.py" | |
|
sed 's,libs/pyTermTk/,,' | |
|
sort | xargs tar cvzf ${_TMP}/TermTk.tgz -C libs/pyTermTk |
|
find tutorial -name '*.py' -o -name '*.json' | |
|
sort | xargs tar cvzf ${_TMP}/tutorial.tgz |
|
find \ |
|
demo/paint.py \ |
|
demo/ttkode.py \ |
|
demo/demo.py \ |
|
demo/showcase/*.* | |
|
sort | xargs tar cvzf ${_TMP}/demo.tgz |
|
find \ |
|
tests/ansi.images.json \ |
|
tests/t.ui/*.* | |
|
sort | xargs tar cvzf ${_TMP}/tests.tgz |
|
|
|
- name: Upload artifatcs to Release |
|
shell: bash |
|
env: |
|
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }} |
|
TAG_NAME: ${{ fromJson(needs.release-please.outputs.rp_out)['TermTk--tag_name'] }} |
|
run: | |
|
_TMP=${{ steps.create-artifacts.outputs.artifacts_dir }} |
|
gh release upload ${TAG_NAME} ${_TMP}/TermTk.tgz |
|
gh release upload ${TAG_NAME} ${_TMP}/tutorial.tgz |
|
gh release upload ${TAG_NAME} ${_TMP}/tests.tgz |
|
gh release upload ${TAG_NAME} ${_TMP}/demo.tgz |
|
rm -rf ${_TMP} |
|
|
|
pyTermTk-deploy-sandbox: |
|
name: Deploy pyTermTk Sandbox |
|
uses: ./.github/workflows/release-sandbox.yml |
|
needs: release-please |
|
secrets: inherit |
|
|
|
pyTermTk-deploy-sandbox-bin: |
|
if: ${{ fromJson(needs.release-please.outputs.rp_out)['libs/pyTermTk--release_created'] }} |
|
name: Deploy pyTermTk Sandbox Binaries |
|
uses: ./.github/workflows/release-sandbox-bin.yml |
|
needs: |
|
- release-please |
|
- pyTermTk-deploy-artifacts |
|
secrets: inherit |
|
|
|
pyTermTk-deploy-docs: |
|
if: ${{ fromJson(needs.release-please.outputs.rp_out)['libs/pyTermTk--release_created'] }} |
|
name: Deploy pyTermTk Docs |
|
uses: ./.github/workflows/release-doc.yml |
|
needs: |
|
- release-please |
|
- pyTermTk-deploy-artifacts |
|
secrets: inherit |
|
|
|
publish-pyTermTk: |
|
if: ${{ fromJson(needs.release-please.outputs.rp_out)['libs/pyTermTk--release_created'] }} |
|
name: Publish pyTermTk |
|
uses: ./.github/workflows/python-publish.yml |
|
with: |
|
pkg_name: pyTermTk |
|
pkg_folder: libs/pyTermTk |
|
needs: |
|
- release-please |
|
secrets: inherit |
|
|
|
publish-ttkDesigner: |
|
if: ${{ fromJson(needs.release-please.outputs.rp_out)['apps/ttkDesigner--release_created'] }} |
|
name: Publish ttkDesigner |
|
uses: ./.github/workflows/python-publish.yml |
|
with: |
|
pkg_name: ttkDesigner |
|
pkg_folder: apps/ttkDesigner |
|
needs: |
|
- release-please |
|
secrets: inherit |
|
|
|
publish-dumbPaintTool: |
|
if: ${{ fromJson(needs.release-please.outputs.rp_out)['apps/dumbPaintTool--release_created'] }} |
|
name: Publish dumbPaintTool |
|
uses: ./.github/workflows/python-publish.yml |
|
with: |
|
pkg_name: dumbPaintTool |
|
pkg_folder: apps/dumbPaintTool |
|
needs: |
|
- release-please |
|
secrets: inherit |
|
|
|
publish-ttkode: |
|
if: ${{ fromJson(needs.release-please.outputs.rp_out)['apps/ttkode--release_created'] }} |
|
name: Publish ttkode |
|
uses: ./.github/workflows/python-publish.yml |
|
with: |
|
pkg_name: ttkode |
|
pkg_folder: apps/ttkode |
|
needs: |
|
- release-please |
|
secrets: inherit |