Skip to content

Commit e9f1c4a

Browse files
Update actions workflows (#57)
* Update bat.yml * Update publish.yml
1 parent eb4172a commit e9f1c4a

2 files changed

Lines changed: 47 additions & 18 deletions

File tree

.github/workflows/bat.yml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
name: Build and Test
22
on: [push]
3+
permissions:
4+
contents: read
35

46
jobs:
57
bat:
68
name: Build and Test
79
runs-on: ubuntu-latest
810
steps:
9-
- uses: actions/checkout@v4
10-
- uses: actions/setup-node@v4
11+
- uses: actions/checkout@v5
12+
- uses: actions/setup-node@v5
1113
with:
1214
node-version: "20"
1315
- name: Perform npm tasks
1416
run: npm run ci
17+
- uses: actions/upload-artifact@v4
18+
with:
19+
name: built-action
20+
path: |
21+
**/*
22+
!node_modules/
23+
integ:
24+
needs: bat
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os: [ubuntu-latest, windows-latest, macos-latest, macos-14]
30+
steps:
31+
- uses: actions/download-artifact@v5
32+
with:
33+
name: built-action
1534

1635
- name: Perform 'setup-matlab'
1736
uses: matlab-actions/setup-matlab@v2
1837

1938
- name: Create buildfile.m in project root for tests
39+
shell: bash
2040
run: |
2141
cat <<'_EOF' >> "buildfile.m"
2242
function plan = buildfile
@@ -56,6 +76,7 @@ jobs:
5676
uses: ./
5777

5878
- name: Verify correct tasks appear in buildlog.txt
79+
shell: bash
5980
run: |
6081
set -e
6182
grep "building" buildlog.txt
@@ -72,6 +93,7 @@ jobs:
7293
tasks: deploy
7394

7495
- name: Verify correct tasks appear in buildlog.txt
96+
shell: bash
7597
run: |
7698
set -e
7799
grep "building" buildlog.txt
@@ -88,6 +110,7 @@ jobs:
88110
tasks: deploy check
89111

90112
- name: Verify correct tasks appear in buildlog.txt
113+
shell: bash
91114
run: |
92115
set -e
93116
grep "building" buildlog.txt
@@ -102,8 +125,9 @@ jobs:
102125
uses: ./
103126
with:
104127
tasks: test("myTests", OutputDetail="concise")
105-
128+
106129
- name: Verify correct tasks appear in buildlog.txt
130+
shell: bash
107131
run: |
108132
set -e
109133
grep "building" buildlog.txt
@@ -120,6 +144,7 @@ jobs:
120144
startup-options: -logfile console.log
121145

122146
- name: Verify tasks appear in buildlog.txt and console.log
147+
shell: bash
123148
run: |
124149
set -e
125150
grep "building" buildlog.txt
@@ -140,8 +165,9 @@ jobs:
140165
with:
141166
tasks: deploy
142167
build-options: -skip test
143-
168+
144169
- name: Verify correct tasks appear in buildlog.txt
170+
shell: bash
145171
run: |
146172
set -e
147173
grep "building" buildlog.txt
@@ -151,15 +177,16 @@ jobs:
151177
grep "deploying" buildlog.txt
152178
! grep "checking" buildlog.txt
153179
rm buildlog.txt
154-
180+
155181
- name: Run build with continue on failure
156182
continue-on-error: true
157183
uses: ./
158184
with:
159185
tasks: error deploy
160186
build-options: -continueOnFailure
161-
187+
162188
- name: Verify correct tasks appear in buildlog.txt
189+
shell: bash
163190
run: |
164191
set -e
165192
grep "erroring" buildlog.txt
@@ -180,6 +207,7 @@ jobs:
180207
startup-options: -logfile console.log
181208

182209
- name: Verify workflow command is added
210+
shell: bash
183211
run: |
184212
grep "::group::deploy" console.log
185213
grep "::error::error task failed" console.log
@@ -194,8 +222,9 @@ jobs:
194222
startup-options: -logfile console.log
195223

196224
- name: Verify summary exception for invalid task
225+
shell: bash
197226
run: |
198227
set -e
199228
! grep "while reading the build summary file:" console.log
200229
! grep "trying to delete the build summary" console.log
201-
rm console.log
230+
rm console.log

.github/workflows/publish.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Publish
2-
32
on:
43
release:
5-
types: [published, edited]
4+
types: published
5+
permissions:
6+
contents: write
67

78
jobs:
89
build:
@@ -11,18 +12,15 @@ jobs:
1112
outputs:
1213
tag: ${{ steps.update-package-version.outputs.version }}
1314
steps:
14-
# Configure runner with the right stuff
15-
- uses: actions/checkout@v4
16-
with:
17-
token: ${{ secrets.GITHUB_TOKEN }}
15+
- uses: actions/checkout@v5
1816
- name: Configure git
1917
run: |
2018
git config user.name 'Release Action'
2119
git config user.email '<>'
22-
- uses: actions/setup-node@v4
20+
- uses: actions/setup-node@v5
2321
with:
24-
node-version: "20"
25-
22+
node-version: 20
23+
2624
# Call `npm version`. It increments the version and commits the changes.
2725
# We'll save the output (new version string) for use in the following
2826
# steps
@@ -31,7 +29,6 @@ jobs:
3129
run: |
3230
git tag -d "${{ github.event.release.tag_name }}"
3331
VERSION=$(npm version "${{ github.event.release.tag_name }}" --no-git-tag-version)
34-
echo "::set-output name=version::$VERSION"
3532
git add package.json package-lock.json
3633
git commit -m "[skip ci] Bump $VERSION"
3734
git push origin HEAD:main
@@ -47,18 +44,21 @@ jobs:
4744
id: release_info
4845
run: |
4946
# Check for semantic versioning
50-
echo "Preparing release for version $longVersion"
5147
longVersion="${{github.event.release.tag_name}}"
48+
echo "Preparing release for version $longVersion"
5249
[[ $longVersion == v[0-9]*.[0-9]*.[0-9]* ]] || (echo "must follow semantic versioning" && exit 1)
5350
majorVersion=$(echo ${longVersion%.*.*})
5451
minorVersion=$(echo ${longVersion%.*})
52+
5553
# Add the built artifacts. Using --force because dist/lib should be in
5654
# .gitignore
5755
git add --force dist lib
56+
5857
# Make the commit
5958
MESSAGE="Build for $(git rev-parse --short HEAD)"
6059
git commit --allow-empty -m "$MESSAGE"
6160
git tag -f -a -m "Release $longVersion" $longVersion
61+
6262
# Get the commit of the tag you just released
6363
commitHash=$(git rev-list -n 1 $longVersion)
6464

0 commit comments

Comments
 (0)