-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c37c6ca
commit 9c2dc68
Showing
5 changed files
with
157 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Build and Test | ||
on: [push] | ||
|
||
jobs: | ||
bat: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Perform npm tasks | ||
run: npm run ci | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: built-action | ||
path: | | ||
**/* | ||
!node_modules/ | ||
integ: | ||
needs: bat | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
release: latest | ||
products: Simulink Simulink_Test | ||
check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); | ||
check-simulink: simulinkVer = ver('simulink'); assert(~isempty(simulinkVer)); | ||
- os: ubuntu-20.04 | ||
release: R2021bU2 | ||
products: | | ||
MATLAB | ||
Simulink | ||
check-matlab: matlabVer = ver('matlab'); assert(strcmp(matlabVer.Release,'(R2021b)')); | ||
check-simulink: simulinkVer = ver('simulink'); assert(strcmp(simulinkVer.Release,'(R2021b)')); | ||
- os: windows-latest | ||
release: latest | ||
products: Simulink | ||
check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); | ||
check-simulink: simulinkVer = ver('simulink'); assert(~isempty(simulinkVer)); | ||
- os: macos-latest | ||
release: latest | ||
products: Simulink | ||
check-matlab: matlabVer = ver('matlab'); assert(~isempty(matlabVer)); | ||
check-simulink: simulinkVer = ver('simulink'); assert(~isempty(simulinkVer)); | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: built-action | ||
- name: Install selected products | ||
id: setup_matlab | ||
uses: ./ | ||
with: | ||
release: ${{ matrix.release }} | ||
products: ${{ matrix.products }} | ||
- name: Check matlabroot output is set | ||
run: 'if [[ "${{ steps.setup_matlab.outputs.matlabroot }}" != *"MATLAB"* ]]; then exit 1; fi' | ||
shell: bash | ||
- name: Check MATLAB version | ||
uses: matlab-actions/run-command@v2 | ||
with: | ||
command: "${{ matrix.check-matlab }}" | ||
- name: Check Simulink version | ||
uses: matlab-actions/run-command@v2 | ||
with: | ||
command: "${{ matrix.check-simulink }}" | ||
- name: Check NoOp on 2nd install | ||
uses: ./ | ||
with: | ||
release: ${{ matrix.release }} | ||
products: ${{ matrix.products }} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [published, edited] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{ steps.update-package-version.outputs.version }} | ||
steps: | ||
# Configure runner with the right stuff | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Configure git | ||
run: | | ||
git config user.name 'Release Action' | ||
git config user.email '<>' | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
# Call `npm version`. It increments the version and commits the changes. | ||
# We'll save the output (new version string) for use in the following | ||
# steps | ||
- name: Update package version | ||
id: update-package-version | ||
run: | | ||
git tag -d "${{ github.event.release.tag_name }}" | ||
VERSION=$(npm version "${{ github.event.release.tag_name }}" --no-git-tag-version) | ||
echo "::set-output name=version::$VERSION" | ||
git add package.json package-lock.json | ||
git commit -m "[skip ci] Bump $VERSION" | ||
git push origin HEAD:main | ||
# Now carry on, business as usual | ||
- name: Perform npm tasks | ||
run: npm run ci | ||
|
||
# Finally, create a detached commit containing the built artifacts and tag | ||
# it with the release. Note: the fact that the branch is locally updated | ||
# will not be relayed (pushed) to origin | ||
- name: Commit to release branch | ||
id: release_info | ||
run: | | ||
# Check for semantic versioning | ||
echo "Preparing release for version $longVersion" | ||
longVersion="${{github.event.release.tag_name}}" | ||
[[ $longVersion == v[0-9]*.[0-9]*.[0-9]* ]] || (echo "must follow semantic versioning" && exit 1) | ||
majorVersion=$(echo ${longVersion%.*.*}) | ||
minorVersion=$(echo ${longVersion%.*}) | ||
# Add the built artifacts. Using --force because dist should be in | ||
# .gitignore | ||
git add --force dist | ||
# Make the commit | ||
MESSAGE="Build for $(git rev-parse --short HEAD)" | ||
git commit --allow-empty -m "$MESSAGE" | ||
git tag -f -a -m "Release $longVersion" $longVersion | ||
# Get the commit of the tag you just released | ||
commitHash=$(git rev-list -n 1 $longVersion) | ||
# Delete the old major and minor version tags locally | ||
git tag -d $majorVersion || true | ||
git tag -d $minorVersion || true | ||
# Make new major and minor version tags locally that point to the commit you got from the "git rev-list" above | ||
git tag -f $majorVersion $commitHash | ||
git tag -f $minorVersion $commitHash | ||
# Force push the new minor version tag to overwrite the old tag remotely | ||
echo "Pushing new tags" | ||
git push -f origin $longVersion | ||
git push -f origin $majorVersion | ||
git push -f origin $minorVersion |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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