Skip to content

Commit

Permalink
Automatically create and upload release artifacts (#30)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nightlark authored Oct 11, 2024
1 parent add2f15 commit bff03c6
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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-*

0 comments on commit bff03c6

Please sign in to comment.