Repository navigation
Added support for code font in release notes #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Term Premium 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@v6 | |
| - 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@v3 | |
| with: | |
| products: > | |
| MATLAB | |
| Statistics_and_Machine_Learning_Toolbox | |
| Econometrics_Toolbox | |
| Optimization_Toolbox | |
| release: ${{ matrix.matlab-version }} | |
| - name: Run the toolbox tests | |
| uses: matlab-actions/run-tests@v3 | |
| package-and-release-toolbox: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v6 | |
| - 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@v3 | |
| with: | |
| products: > | |
| MATLAB | |
| Statistics_and_Machine_Learning_Toolbox | |
| Econometrics_Toolbox | |
| Optimization_Toolbox | |
| - name: Package toolbox | |
| uses: matlab-actions/run-command@v3 | |
| with: | |
| command: | | |
| logLines = readlines( "tbx/termprem/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() ); | |
| tempFile = "ReleaseNotes.txt"; | |
| writelines( releaseNotes, tempFile ) | |
| delimiter = "EOF_" + matlab.lang.internal.uuid(); | |
| systemCommand = sprintf( [ ... | |
| 'echo "RELEASE_NOTES<<%s" >> $GITHUB_ENV && ', ... | |
| 'cat "%s" >> $GITHUB_ENV && ', ... | |
| 'echo "%s" >> $GITHUB_ENV' ], ... | |
| delimiter, tempFile, delimiter ); | |
| system( systemCommand ); | |
| delete( tempFile ) | |
| buildtool package -skip test -skip check | |
| - name: Release toolbox | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| name: Term Premium Modelling ${{ env.TOOLBOX_VERSION }} | |
| tag_name: v${{ env.TOOLBOX_VERSION }} | |
| body: ${{ env.RELEASE_NOTES }} | |
| draft: false | |
| make_latest: true | |
| files: releases/Term_Premium_Modelling.mltbx | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |