Skip to content

Commit f447535

Browse files
committed
Merge pull request #2 from mathworks-continuous-integration/jpereira/test-release
The first release implementation
2 parents 5371b2e + ce7d966 commit f447535

File tree

17 files changed

+6542
-4
lines changed

17 files changed

+6542
-4
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist/* binary
2+
lib/* binary

.github/workflows/bat.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build and Test
2+
on: [push]
3+
4+
jobs:
5+
bat:
6+
name: Build and Test
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-node@v1
11+
with:
12+
node-version: '12'
13+
- name: Perform npm tasks
14+
run: npm run ci
15+
16+
- name: Checkout setup-matlab-action
17+
uses: actions/checkout@v2
18+
with:
19+
repository: mathworks-continuous-integration/setup-matlab-action
20+
ref: v0.1.0
21+
path: setup-matlab-action
22+
ssh-key: ${{ secrets.SETUP_MATLAB_COMMAND_KEY }}
23+
- name: Perform 'setup-matlab-action'
24+
uses: ./setup-matlab-action
25+
env:
26+
MATHWORKS_TOKEN: ${{ secrets.MATHWORKS_TOKEN }}
27+
28+
- name: Exercise RunMATLABCommand
29+
uses: ./
30+
with:
31+
command: "disp('hello world');"

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-latest
11+
outputs:
12+
tag: ${{ steps.release_info.outputs.tag }}
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
- uses: actions/setup-node@v1
18+
with:
19+
node-version: '12'
20+
- name: Perform npm tasks
21+
run: npm ci && npm run build && npm run package
22+
23+
- name: Set release vars
24+
id: release_helpers
25+
run: |
26+
echo "::set-output name=commit::$(git rev-parse --short HEAD)"
27+
echo "::set-output name=package_version::$(node -e "console.log(require('./package.json').version);")"
28+
29+
- name: Commit to release branch
30+
id: release_info
31+
run: |
32+
git config user.name 'Build Action'
33+
git config user.email '<>'
34+
35+
TAG="v${{ steps.release_helpers.outputs.package_version }}"
36+
BRANCH="release/$TAG"
37+
git switch -c $BRANCH
38+
git add --force dist lib
39+
40+
MESSAGE="Build for ${{ steps.release_helpers.outputs.commit }}"
41+
git commit --allow-empty -m "$MESSAGE"
42+
git tag -a -m "Release $TAG" $TAG
43+
git push origin $TAG
44+
45+
echo "::set-output name=tag::$TAG"
46+
47+
release:
48+
name: Release
49+
runs-on: ubuntu-latest
50+
needs: build
51+
steps:
52+
- name: Create Release
53+
uses: actions/create-release@v1
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
tag_name: ${{ needs.build.outputs.tag }}
58+
release_name: Release ${{ needs.build.outputs.tag }}
59+
draft: false
60+
prerelease: false

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
## For development environment
22
.vscode
33

4-
## Don't include intermediate TypeScript compilation
5-
tsout
4+
# Don't include intermediate TypeScript compilation;
5+
# it should be forcibly added on release
6+
lib
7+
8+
# Leave out dist; it should be forcibly added on release
9+
dist
610

711
## https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore
812
# Logs

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Run MATLAB® Command
2+
3+
This action executes a MATLAB script, function, or statement using the _first_
4+
MATLAB version on the runner's system `PATH`.
5+
6+
MATLAB exits with exit code 0 if the specified script, function, or statement
7+
executes successfully without error. Otherwise, MATLAB terminates with a nonzero
8+
exit code, which causes the build to fail. You can use the
9+
[`assert`](https://www.mathworks.com/help/matlab/ref/assert.html) or
10+
[`error`](https://www.mathworks.com/help/matlab/ref/assert.html) functions in
11+
the command to ensure that builds fail when necessary. When you use this task,
12+
all of the required files must be on the MATLAB search path.
13+
14+
## Usage
15+
16+
You can use this action `with`:
17+
| Argument | Description |
18+
|-----------|-------------|
19+
| `command` | (Required) Script, function, or statement to execute. <br/> If the value of `command` is the name of a MATLAB script or function, do not specify the file extension. If you specify more than one MATLAB command, use a comma or semicolon to separate the commands. <br/> **Example**: `myscript` <br/> **Example**: `results = runtests, assertSuccess(results);`
20+
21+
### Using a GitHub-hosted runner?
22+
If you are using a GitHub-hosted runner, you can use the [Set up MATLAB action](https://github.com/mathworks/setup-matlab-action/) to install MATLAB on the runner.
23+
24+
## Example
25+
26+
```yaml
27+
name: Sample workflow
28+
on: [push]
29+
30+
jobs:
31+
my-job:
32+
name: Say hello from MATLAB
33+
runs-on: ubuntu-latest
34+
steps:
35+
# Set up MATLAB using this action first if running on a GitHub-hosted runner!
36+
- uses: mathworks/setup-matlab-action@v0
37+
38+
- name: Run "disp('hello world')" directly using MATLAB
39+
uses: mathworks/run-matlab-command-action@v0
40+
with:
41+
command: disp('hello world')
42+
```
43+
44+
## See also
45+
- [Set up MATLAB action](https://github.com/mathworks/setup-matlab-action/)
46+
- [Run MATLAB Tests](https://github.com/mathworks/run-matlab-tests-action/)
47+
- [Continuous Integration - MATLAB & Simulink](https://www.mathworks.com/solutions/continuous-integration.html)
48+
49+
## Contact Us
50+
If you have any questions or suggestions, please contact MathWorks® at continuous-integration@mathworks.com.

SECURITY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reporting Security Vulnerabilities
2+
3+
If you believe you have discovered a security vulnerability, please report it to
4+
[security@mathworks.com](mailto:security@mathworks.com). Please see
5+
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
6+
for additional information.

action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2020 The MathWorks, Inc.
2+
3+
name: Run MATLAB Command
4+
description: >-
5+
Execute a MATLAB script, function, or statement.
6+
MATLAB exits with exit code 0 if the specified script, function, or statement
7+
executes successfully without error. Otherwise, MATLAB terminates with a
8+
nonzero exit code, which causes the build to fail. You can use the assert or
9+
error functions in the command to ensure that builds fail when necessary. When
10+
you use this task, all of the required files must be on the MATLAB search
11+
path.
12+
inputs:
13+
command:
14+
description: >-
15+
Script, function, or statement to execute.
16+
If the value of `command` is the name of a MATLAB script or function, do
17+
not specify the file extension. If you specify more than one MATLAB
18+
command, use a comma or semicolon to separate the commands.
19+
required: true
20+
runs:
21+
using: node12
22+
main: dist/index.js

license.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2020, The MathWorks, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
3. In all cases, the software is, and all modifications and derivatives of the
15+
software shall be, licensed to you solely for use in conjunction with
16+
MathWorks products and service offerings.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)