From e8a9d4260f44739767ed6195ac77b3d573651c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sloev=20/=20Johannes=20Valbj=C3=B8rn?= Date: Thu, 16 Jan 2025 12:17:49 +0100 Subject: [PATCH 1/3] add automatic python wheel generation, fixes #https://github.com/stevenlovegrove/Pangolin/issues/925 --- .github/workflows/build.yml | 17 +++++++++++++++++ .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9942a6fba..7b17846a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -122,6 +122,23 @@ jobs: run: | cmake --build build --target test + - name: Make release_artifacts folder + run: mkdir release_artifacts + + - name: Add prefix to python_wheel artifact + run: | + for file in ./build/pypangolin-*.whl; do + mv $file ./release_artifacts/${{matrix.os}}_shared_libs_${{matrix.shared_libs}}.$(basename $file); + done + + - name: 'Upload release_artifacts' + uses: actions/upload-artifact@v4 + with: + name: "release_artifacts_${{matrix.os}}_${{matrix.shared_libs}}" + path: release_artifacts/* + retention-days: 2 + + emscripten: runs-on: ubuntu-22.04 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..804cb25c8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: release + +on: + workflow_run: + workflows: [build] + types: [completed] + branches: [master] + +jobs: + prepare_artifacts: + # Only run the deployment if the build workflow succeeded. + if: ${{ github.event.workflow_run.conclusion == 'success'}} && contains(github.ref, '/tags/v') + runs-on: ubuntu-22.04 + + steps: + - name: Download build artifact from triggered workflow + uses: dawidd6/action-download-artifact@v2 + with: + run_id: ${{ github.event.workflow_run.id }} + name: ./release_artifacts/* + name_is_regexp: true + path: ./release_artifacts + - name: Upload release + uses: softprops/action-gh-release@v2 + with: + name: ${{ github.ref_name }} + tag_name: ${{ github.ref_name }} + files: release_artifacts/* + token: ${{ secrets.GITHUB_TOKEN }} + generate_release_notes: true \ No newline at end of file From 4c755770437e50f5fad68cae48ff221fe8335453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sloev=20/=20Johannes=20Valbj=C3=B8rn?= Date: Thu, 16 Jan 2025 12:29:45 +0100 Subject: [PATCH 2/3] change from GITHUB_TOKEN to REPO_TOKEN because github won't allow secrets starting with GITHUB --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b17846a2..28e139a10 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -175,4 +175,4 @@ jobs: # build_dir path relative to ${{runner.workspace}}/Pangolin build_dir: ../www env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 804cb25c8..f2f8fe7d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,5 +26,5 @@ jobs: name: ${{ github.ref_name }} tag_name: ${{ github.ref_name }} files: release_artifacts/* - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.REPO_TOKEN }} generate_release_notes: true \ No newline at end of file From a4838cff7bd634e373f54d9e7ec68dade755f800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sloev=20/=20Johannes=20Valbj=C3=B8rn?= Date: Thu, 16 Jan 2025 12:37:16 +0100 Subject: [PATCH 3/3] use one file for all build and release --- .github/workflows/build.yml | 22 ++++++++++++++++++++++ .github/workflows/release.yml | 30 ------------------------------ 2 files changed, 22 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28e139a10..5a118b2fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,3 +176,25 @@ jobs: build_dir: ../www env: GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} + + release: + needs: build + if: contains(needs.*.result, 'success') && contains(github.ref, '/tags/v') + runs-on: ubuntu-22.04 + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: release_artifacts_* + path: ./release_artifacts + merge-multiple: true + + - name: Upload release + uses: softprops/action-gh-release@v2 + with: + name: ${{ github.ref_name }} + tag_name: ${{ github.ref_name }} + files: release_artifacts/* + token: ${{ secrets.REPO_TOKEN }} + generate_release_notes: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index f2f8fe7d5..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: release - -on: - workflow_run: - workflows: [build] - types: [completed] - branches: [master] - -jobs: - prepare_artifacts: - # Only run the deployment if the build workflow succeeded. - if: ${{ github.event.workflow_run.conclusion == 'success'}} && contains(github.ref, '/tags/v') - runs-on: ubuntu-22.04 - - steps: - - name: Download build artifact from triggered workflow - uses: dawidd6/action-download-artifact@v2 - with: - run_id: ${{ github.event.workflow_run.id }} - name: ./release_artifacts/* - name_is_regexp: true - path: ./release_artifacts - - name: Upload release - uses: softprops/action-gh-release@v2 - with: - name: ${{ github.ref_name }} - tag_name: ${{ github.ref_name }} - files: release_artifacts/* - token: ${{ secrets.REPO_TOKEN }} - generate_release_notes: true \ No newline at end of file