diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index ee5f3bf8..08e86a83 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,157 +1,148 @@ name: publish-release on: - workflow_dispatch: ## DEBUG - push: - branches: ["main"] - pull_request: - branches: ["main"] - -# FIXME: to uncomment when ready for deploy -# on: -# release: -# types: [published] -# workflow_dispatch: + release: + types: [published] + workflow_dispatch: jobs: ################################################################################ ## Building ################################################################################ - ## FIXME: uncomment when ready for deploy - # sync-version: - # runs-on: windows-latest - - # steps: - # - uses: actions/checkout@v2 - - # - name: Install Python and pythonnet - # uses: actions/setup-python@v2 - # with: - # python-version: '3.9.10' - - # - name: Install Python dependencies - # run: | - # python -m pip install --upgrade pip - # pip install invoke - - # - name: Update the version across the project and commit the changes - # run: invoke versionize - - # - name: Install GitHub CLI - # run: | - # choco install gh - # - name: Authenticate GitHub CLI - # run: | - # echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token - - # - name: Create a new branch and commit the version change - # # Delete branch remotely version-sync-branch (if exists) - # run: | - # git fetch --prune - # if git branch -r | grep -q 'origin/version-sync-branch'; then - # git push origin --delete version-sync-branch - # else - # echo "Branch version-sync-branch does not exist." - # fi - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # shell: bash - # # Create new branch and commit version change - # - run: | - # git config --global user.email "github-actions[bot]@users.noreply.github.com" - # git config --global user.name "github-actions[bot]" - # git checkout -b version-sync-branch - # git commit -am "ACTION_BOT: Sync version for release" - # git push --set-upstream origin version-sync-branch - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # # Close existing pull requests for version-sync-branch - # - run: | - # gh pr list --state open --head version-sync-branch --json number --jq '.[].number' | ForEach-Object { gh pr close $_ } - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # shell: pwsh - # # Create pull request - # - run: | - # gh pr create --title "ACTION_BOT: Sync version for release" --body "Sync version for release" --base main --head version-sync-branch --label ACTION_BOT - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # # Merge pull request - # - run: | - # $pr = gh pr list --head version-sync-branch --json number --jq '.[0].number' - # gh pr merge $pr --squash --delete-branch --admin - # env: - # GITHUB_TOKEN: ${{ secrets.DF_COBOT_PAT_TOKEN }} - # shell: pwsh - - # build-ghusers: - # runs-on: windows-latest - # # needs: sync-version # FIXME: uncomment when ready for deploy - - # steps: - # - uses: actions/checkout@v2 - # - uses: NuGet/setup-nuget@v1.0.5 - - # - name: Install CPython and pythonnet package - # run: | - # choco install python --version=3.9.10 - # python -m pip install pythonnet==3.0.3 - # python -m pip install invoke - - # - name: create the build folder - # run: mkdir build - - # - name: Flag the ghuser codes with the correct package version - # run: invoke flagerize - - # - name: Invoke the componentizer - # run: | - # mkdir build/gh - # invoke ghcomponentize - - # - uses: actions/upload-artifact@v4 - # with: - # name: ghuser-components - # path: build/gh - - # build-yak-package: - # runs-on: windows-latest - # needs: build-ghusers - - # steps: - # - uses: actions/checkout@v2 - - # - name: Install Python and pythonnet - # uses: actions/setup-python@v2 - # with: - # python-version: '3.9.10' - - # - name: Install Python dependencies - # run: | - # python -m pip install --upgrade pip - # pip install invoke - # pip install pythonnet - - # - name: Download the ghuser components - # uses: actions/download-artifact@v4 - # with: - # name: ghuser-components - # path: build/gh - - # - name: Build the yak package - # run: invoke yakerize - - # - name: Save artifact the yak package as an artifact - # uses: actions/upload-artifact@v4 - # with: - # name: yak_package_artifact - # path: build/yak/*.yak + sync-version: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install Python and pythonnet + uses: actions/setup-python@v2 + with: + python-version: '3.9.10' + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install invoke + + - name: Update the version across the project and commit the changes + run: invoke versionize + + - name: Install GitHub CLI + run: | + choco install gh + - name: Authenticate GitHub CLI + run: | + echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token + + - name: Create a new branch and commit the version change + # Delete branch remotely version-sync-branch (if exists) + run: | + git fetch --prune + if git branch -r | grep -q 'origin/version-sync-branch'; then + git push origin --delete version-sync-branch + else + echo "Branch version-sync-branch does not exist." + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + # Create new branch and commit version change + - run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git checkout -b version-sync-branch + git commit -am "ACTION_BOT: Sync version for release" + git push --set-upstream origin version-sync-branch + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Close existing pull requests for version-sync-branch + - run: | + gh pr list --state open --head version-sync-branch --json number --jq '.[].number' | ForEach-Object { gh pr close $_ } + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: pwsh + # Create pull request + - run: | + gh pr create --title "ACTION_BOT: Sync version for release" --body "Sync version for release" --base main --head version-sync-branch --label ACTION_BOT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Merge pull request + - run: | + $pr = gh pr list --head version-sync-branch --json number --jq '.[0].number' + gh pr merge $pr --squash --delete-branch --admin + env: + GITHUB_TOKEN: ${{ secrets.DF_COBOT_PAT_TOKEN }} + shell: pwsh + + build-ghusers: + runs-on: windows-latest + needs: sync-version + + steps: + - uses: actions/checkout@v2 + - uses: NuGet/setup-nuget@v1.0.5 + + - name: Install CPython and pythonnet package + run: | + choco install python --version=3.9.10 + python -m pip install pythonnet==3.0.3 + python -m pip install invoke + + - name: create the build folder + run: mkdir build + + - name: Flag the ghuser codes with the correct package version + run: invoke flagerize + + - name: Invoke the componentizer + run: | + mkdir build/gh + invoke ghcomponentize + + - uses: actions/upload-artifact@v4 + with: + name: ghuser-components + path: build/gh + + build-yak-package: + runs-on: windows-latest + needs: build-ghusers + + steps: + - uses: actions/checkout@v2 + + - name: Install Python and pythonnet + uses: actions/setup-python@v2 + with: + python-version: '3.9.10' + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install invoke + pip install pythonnet + + - name: Download the ghuser components + uses: actions/download-artifact@v4 + with: + name: ghuser-components + path: build/gh + + - name: Build the yak package + run: invoke yakerize + + - name: Save artifact the yak package as an artifact + uses: actions/upload-artifact@v4 + with: + name: yak_package_artifact + path: build/yak/*.yak #=============================================================================== pypi_build: runs-on: windows-latest - # needs: sync-version # FIXME: uncomment when ready for deploy + needs: sync-version steps: - uses: actions/checkout@v4 @@ -196,69 +187,65 @@ jobs: ## Publishing ################################################################################ - # publish_test_yak: - # needs: build-yak-package - # runs-on: windows-latest - - # steps: - # - name: Checkout repo - # uses: actions/checkout@v2 - # # with: - # # ref: main # FIXME: to be uncommented when ready for deploy - - # - name: Download artifact - # uses: actions/download-artifact@v4 - # with: - # name: yak_package_artifact - # path: build/yak - - # - name: Publish to Yak test server - # run: | - # $YAK_FILE=$(ls *.yak) - # echo "Yak file: $YAK_FILE" - # ..\..\invokes\yaker\exec\Yak.exe push --source https://test.yak.rhino3d.com $YAK_FILE - # working-directory: build/yak - # env: - # YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }} - # continue-on-error: true - # - name: Verify the Yak test package - # run: | - # ..\..\invokes\yaker\exec\Yak.exe search --source https://test.yak.rhino3d.com --all --prerelease script-sync - # working-directory: build/yak - # env: - # YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }} - - # publish_to_yak: - # needs: publish_test_yak - # runs-on: windows-latest - - # steps: - # - name: Checkout repo - # uses: actions/checkout@v2 - # # with: - # # ref: main # FIXME: to be uncommented when ready for deploy - - # - name: Download artifact - # uses: actions/download-artifact@v4 - # with: - # name: yak_package_artifact - # path: build/yak - - # - name: Publish to Yak server - # run: | - # $YAK_FILE=$(ls *.yak) - # echo "Yak file: $YAK_FILE" - # ..\..\invokes\yaker\exec\Yak.exe push $YAK_FILE - # working-directory: build/yak - # env: - # YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }} - # # check the real release - # - name: Verify the Yak test package - # run: | - # ..\..\invokes\yaker\exec\Yak.exe search --all --prerelease script-sync - # working-directory: build/yak - # env: - # YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }} + publish_test_yak: + needs: build-yak-package + runs-on: windows-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: yak_package_artifact + path: build/yak + + - name: Publish to Yak test server + run: | + $YAK_FILE=$(ls *.yak) + echo "Yak file: $YAK_FILE" + ..\..\invokes\yaker\exec\Yak.exe push --source https://test.yak.rhino3d.com $YAK_FILE + working-directory: build/yak + env: + YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }} + continue-on-error: true + - name: Verify the Yak test package + run: | + ..\..\invokes\yaker\exec\Yak.exe search --source https://test.yak.rhino3d.com --all --prerelease script-sync + working-directory: build/yak + env: + YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }} + + publish_to_yak: + needs: publish_test_yak + runs-on: windows-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: yak_package_artifact + path: build/yak + + - name: Publish to Yak server + run: | + $YAK_FILE=$(ls *.yak) + echo "Yak file: $YAK_FILE" + ..\..\invokes\yaker\exec\Yak.exe push $YAK_FILE + working-directory: build/yak + env: + YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }} + # check the real release + - name: Verify the Yak test package + run: | + ..\..\invokes\yaker\exec\Yak.exe search --all --prerelease script-sync + working-directory: build/yak + env: + YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }} #=============================================================================== @@ -296,6 +283,68 @@ jobs: uses: actions/download-artifact@v4 with: name: diffcheck_pypi_dist + path: dist/ - name: Publish distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + + + ################################################################################ + ## Upload release artifacts + ################################################################################ + release_artifacts: + needs: [build-yak-package, pypi_build] + runs-on: ubuntu-latest + if: github.event_name == 'release' + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Download yak artifact + uses: actions/download-artifact@v4 + with: + name: yak_package_artifact + path: build/yak + - name: Download pypi dist artifact + uses: actions/download-artifact@v4 + with: + name: diffcheck_pypi_dist + + - name: Get YAK artifact path + id: get_yak_path + run: | + echo "::set-output name=yak_path::$(find build/yak -name '*.yak')" + shell: bash + - name: Get PyPI dist path + id: get_pypi_dist_path + run: | + echo "::set-output name=pypi_dist_path::$(find dist -name '*.whl')" + shell: bash + - name: Print YAK artifact path + run: | + echo ${{ steps.get_yak_path.outputs.yak_path }} + shell: bash + - name: Print PyPI dist path + run: | + echo ${{ steps.get_pypi_dist_path.outputs.pypi_dist_path }} + shell: bash + + - name: Upload .yak artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ steps.get_yak_path.outputs.yak_path }} + asset_name: diffCheck.yak + asset_content_type: application/octet-stream + - name: Upload .whl artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ steps.get_pypi_dist_path.outputs.pypi_dist_path }} + asset_name: diffCheck-py-dist.whl + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index c0158171..f4461c19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16.) -project(diffCheck VERSION 0.0.31 LANGUAGES CXX C) +project(diffCheck VERSION 0.0.32 LANGUAGES CXX C) set(CMAKE_CXX_STANDARD 17) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) diff --git a/manifest.yml b/manifest.yml index 166f3f99..37b86589 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1,6 +1,6 @@ --- name: diffCheck -version: 0.0.31 +version: 0.0.32 authors: - Andrea Settimi - Damien Gilliard diff --git a/src/gh/diffCheck/diffCheck/__init__.py b/src/gh/diffCheck/diffCheck/__init__.py index 6938d3b6..d82fc1c1 100644 --- a/src/gh/diffCheck/diffCheck/__init__.py +++ b/src/gh/diffCheck/diffCheck/__init__.py @@ -1,6 +1,6 @@ import os -__version__ = "0.0.31" +__version__ = "0.0.32" # make the dlls available to the python interpreter PATH_TO_DLL = "dlls" diff --git a/src/gh/diffCheck/setup.py b/src/gh/diffCheck/setup.py index 7758ebb7..68cd7630 100644 --- a/src/gh/diffCheck/setup.py +++ b/src/gh/diffCheck/setup.py @@ -4,7 +4,7 @@ setup( name="diffCheck", - version="0.0.31", + version="0.0.32", packages=find_packages(), install_requires=[ "numpy",