diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 3aeb67cda..2acb43d7d 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -23,45 +23,3 @@ jobs: tools_directory: tools secrets: DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} - - update-codemeta: - name: Update codemeta.json - needs: prepare-release - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.DEPLOY_KEY }} - ref: main - - - name: Determine version string - id: version - run: | - if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - echo "tag=v${{ inputs.version }}" >> $GITHUB_OUTPUT - else - echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT - fi - - - name: Set up MATLAB - uses: matlab-actions/setup-matlab@v2 - - - name: Update codemeta.json - uses: matlab-actions/run-command@v2 - with: - command: addpath(genpath("tools")); updateCodeMetaFile("${{ steps.version.outputs.tag }}") - - - name: Commit and push changes - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add codemeta.json - if git diff --cached --quiet; then - echo "No changes to commit" - else - git commit -m "Update codemeta.json for ${{ steps.version.outputs.tag }} [skip actions]" - git push - fi diff --git a/codemeta.json b/codemeta.json index cc2691acb..acb343f02 100644 --- a/codemeta.json +++ b/codemeta.json @@ -18,7 +18,7 @@ "linked-data", "neuroscience" ], - "releaseNotes": "https://github.com/openMetadataInitiative/openMINDS_MATLAB/releases#release-v0.12.0", + "releaseNotes": "https://github.com/openMetadataInitiative/openMINDS_MATLAB/releases/tag/v0.12.0", "funding": "https://cordis.europa.eu/project/id/945539", "developmentStatus": "active", "funder": { diff --git a/tools/tasks/updateCodeMetaFile.m b/tools/tasks/updateCodeMetaFile.m deleted file mode 100644 index 86c89628d..000000000 --- a/tools/tasks/updateCodeMetaFile.m +++ /dev/null @@ -1,60 +0,0 @@ -function codeMetaInfo = updateCodeMetaFile(versionString) - - arguments - versionString (1,1) string {mustBeTextScalar, mustBeValidVersionString} - end - - if startsWith(versionString, "v") - versionStringNumeric = extractAfter(versionString, 1); - else - error('Expected versionString to start with "v"') - end - - projectRootDirectory = ommtools.projectdir(); - - codeMetaFilePath = fullfile(projectRootDirectory, 'codemeta.json'); - codeMetaInfo = jsondecode( fileread(codeMetaFilePath) ); - - % The toolbox packaging file is the source of truth for the supported - % MATLAB releases, so read it from there instead of keeping a copy here. - toolboxInfoFilePath = fullfile(projectRootDirectory, 'tools', 'MLToolboxInfo.json'); - toolboxInfo = jsondecode( fileread(toolboxInfoFilePath) ); - assert(isempty(toolboxInfo.ToolboxOptions.MaximumMatlabRelease), ... - 'runtimePlatform assumes no maximum MATLAB release. Update this task if one is set.') - minimumMatlabRelease = string(toolboxInfo.ToolboxOptions.MinimumMatlabRelease); - - codeMetaInfo.version = versionStringNumeric; - codeMetaInfo.downloadUrl = sprintf("https://github.com/openMetadataInitiative/openMINDS_MATLAB/releases/download/%s/openMINDS_MATLAB_%s.mltbx", ... - versionString, strrep(versionString, '.', '_')); - % GitHub anchors each release section on the releases page by its tag, - % so the release notes link can point at this version's notes directly. - releasesPageUrl = "https://github.com/openMetadataInitiative/openMINDS_MATLAB/releases"; - codeMetaInfo.releaseNotes = releasesPageUrl + "#release-" + versionString; - codeMetaInfo.runtimePlatform = "MATLAB " + minimumMatlabRelease + " or later"; - % datePublished is the first release date, so it is left untouched here. - codeMetaInfo.dateModified = string(datetime('today', 'Format', 'yyyy-MM-dd')); - - if isscalar(codeMetaInfo.author) - % Ensure author is encoded as an array - codeMetaInfo.author = {codeMetaInfo.author}; - end - - jsonStr = jsonencode(codeMetaInfo, 'PrettyPrint', true); - - % Add EOF newline - jsonStr = [jsonStr, newline]; - - % Fix json-ld @props - jsonStr = strrep(jsonStr, 'x_context', '@context'); - jsonStr = strrep(jsonStr, 'x_type', '@type'); - jsonStr = strrep(jsonStr, 'x_id', '@id'); - - fid = fopen(codeMetaFilePath, 'wt'); - fwrite(fid, jsonStr); - fclose(fid); -end - -function mustBeValidVersionString(versionString) - pattern = 'v\d+\.\d+\.\d+'; - assert( ~ismissing( regexp(versionString, pattern, 'match', 'once')), 'Invalid version string. Must be formatted as v..' ) -end