-
Notifications
You must be signed in to change notification settings - Fork 3
67 lines (60 loc) · 1.96 KB
/
prepare-release.yml
File metadata and controls
67 lines (60 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Prepare toolbox release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Matches tags like v1.2.3
workflow_dispatch:
inputs:
version:
description: 'Version number in major.minor.patch format'
required: true
type: string
jobs:
prepare-release:
name: Prepare toolbox release
uses: ehennestad/matbox-actions/.github/workflows/prepare-release-workflow.yml@v1
with:
version: ${{ inputs.version }} # Do not change
ref_name: ${{ github.ref_name }} # Do not change
source_directory: code
tests_directory: tools/tests
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 }}"
git push
fi