From bff03c616b606ae1bede862bc6d50614c986462e Mon Sep 17 00:00:00 2001 From: Ryan Mast <3969255+nightlark@users.noreply.github.com> Date: Thu, 10 Oct 2024 18:21:55 -0700 Subject: [PATCH] Automatically create and upload release artifacts (#30) When a new release is created, this will build the release artifacts and upload them to the release and ensures that the description text matches the one in the default template in HELICS's release checklist. An extra layer of nested archives is also removed -- so release will no longer will have a tar.gz or zip files inside the artifact zip file that was uploaded to previous releases. Fixes #20 --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc276fe..dbb18a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,15 @@ name: Test matHELICS - on: push: + branches: + - main pull_request: branches: - main + release: + types: + - published workflow_dispatch: - #schedule: - # - cron: "35 10 * * 1,3,5 # running early in the morning (UTC) jobs: ci-test: @@ -39,11 +41,17 @@ jobs: uses: matlab-actions/run-command@v2 with: command: buildHelicsInterface('helics',true) + - name: Rename artifact (Windows) + if: runner.os == 'Windows' + run: mv matHELICS.zip matHELICS-${{ matrix.os }}.zip + - name: Rename artifact + if: runner.os != 'Windows' + run: mv matHELICS.tar.gz matHELICS-${{ matrix.os }}.tar.gz - name: store package uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}-matHELICS - path: matHELICS.* + path: matHELICS-${{ matrix.os }}.* - name: run startup uses: matlab-actions/run-command@v2 with: @@ -53,3 +61,20 @@ jobs: with: command: addpath('tests'),addpath('helics'),runAllTests + release: + if: github.event_name == 'release' && github.event.action == 'published' + runs-on: ubuntu-latest + needs: ci-test + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: # no name specified, so all artifacts will be downloaded + path: ./artifacts + merge-multiple: true + - name: List files in artifacts + run: ls ./artifacts + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + body: Release for [HELICS ${{ github.ref_name }}](https://github.com/GMLC-TDC/HELICS/releases/tag/${{ github.ref_name }}) + files: ./artifacts/matHELICS-*