Skip to content

Used MATLAB to extract the release notes #10

Used MATLAB to extract the release notes

Used MATLAB to extract the release notes #10

Workflow file for this run

name: Commodity Volatility Modelling Actions
on:
push:
branches: [main]
tags:
- 'v*'
pull_request:
branches: [main]
workflow_dispatch:
jobs:
run-tests:
strategy:
matrix:
platform: [windows-latest]
matlab-version: [R2026a]
runs-on: ${{ matrix.platform }}
continue-on-error: false
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Start a display server for jobs running on Linux
if: ${{ matrix.platform == 'ubuntu-latest' }}
run: |
sudo apt-get install -y xvfb
Xvfb :99 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Set up MATLAB on the runner
uses: matlab-actions/setup-matlab@v2
with:
products: >
MATLAB
Statistics_and_Machine_Learning_Toolbox
Econometrics_Toolbox
Datafeed_Toolbox
Optimization_Toolbox
Financial_Toolbox
release: ${{ matrix.matlab-version }}
- name: Run the toolbox tests
uses: matlab-actions/run-tests@v2
package-and-release-toolbox:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Extract version from tag
shell: bash
run: |
TOOLBOX_VERSION="${GITHUB_REF_NAME#v}"
echo "TOOLBOX_VERSION=$TOOLBOX_VERSION" >> $GITHUB_ENV
- name: Set up MATLAB on the runner
uses: matlab-actions/setup-matlab@v2
with:
products: >
MATLAB
Statistics_and_Machine_Learning_Toolbox
Econometrics_Toolbox
Datafeed_Toolbox
Optimization_Toolbox
Financial_Toolbox
- name: Package toolbox
uses: matlab-actions/run-command@v2
with:
command: |
logLines = readlines( "tbx/commodities/Changelog.md" );
startIdx = find( logLines == "## Version " + getenv( "TOOLBOX_VERSION" ) );
allVersionLines = find( startsWith( logLines, "##" ) );
endIdx = allVersionLines(find( allVersionLines > startIdx, 1 )) - 1;
releaseNotes = join( logLines(startIdx:endIdx), newline() );
systemCommand = sprintf( [ ...
'echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV && ', ...
'echo "%s" >> $GITHUB_ENV && ', ...
'echo "EOF" >> $GITHUB_ENV'], releaseNotes );
system( systemCommand );
buildtool package -skip test -skip check
- name: Release toolbox
uses: softprops/action-gh-release@v3
with:
name: Commodity Volatility Modelling ${{ env.TOOLBOX_VERSION }}
tag_name: v${{ env.TOOLBOX_VERSION }}
body: ${{ env.RELEASE_NOTES }}
draft: false
make_latest: true
files: releases/Commodity_Volatility_Modelling.mltbx
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}