Skip to content

Commit e2dee3c

Browse files
authored
Merge pull request #30 from github/improve-ci-workflows
improve ci workflows
2 parents 6ceeae7 + 8dc1aff commit e2dee3c

File tree

4 files changed

+29
-38
lines changed

4 files changed

+29
-38
lines changed

.github/workflows/lint.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,20 @@ on:
66
- main
77
- 'releases/*'
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
lint:
1114
runs-on: ubuntu-latest
1215
steps:
1316
- uses: actions/checkout@v3
1417

15-
# check the node version from the .node-version file
16-
- name: fetch node version
17-
id: node-version
18-
run: |
19-
version=$(cat .node-version)
20-
echo "version=${version}" >> $GITHUB_OUTPUT
21-
2218
- name: setup node
23-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
2420
with:
25-
node-version: ${{ steps.node-version.outputs.version }}
26-
cache: npm
21+
node-version-file: .node-version
22+
cache: 'npm'
2723

2824
- name: install dependencies
2925
run: npm ci

.github/workflows/package-check.yml

+10-14
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,29 @@ on:
77
pull_request:
88
workflow_dispatch:
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
package-check:
1215
runs-on: ubuntu-latest
1316

1417
steps:
1518
- uses: actions/checkout@v3
1619

17-
# check the node version from the .node-version file
18-
- name: fetch node version
19-
id: node-version
20-
run: |
21-
version=$(cat .node-version)
22-
echo "version=${version}" >> $GITHUB_OUTPUT
23-
2420
- name: setup node
25-
uses: actions/setup-node@v3
21+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
2622
with:
27-
node-version: ${{ steps.node-version.outputs.version }}
28-
cache: npm
23+
node-version-file: .node-version
24+
cache: 'npm'
2925

30-
- name: Install dependencies
26+
- name: install dependencies
3127
run: npm ci
3228

33-
- name: Rebuild the dist/ directory
29+
- name: rebuild the dist/ directory
3430
run: npm run bundle
3531

36-
- name: Compare the expected and actual dist/ directories
32+
- name: compare the expected and actual dist/ directories
3733
run: |
3834
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
3935
echo "Detected uncommitted changes after build. See status below:"
@@ -43,7 +39,7 @@ jobs:
4339
id: diff
4440

4541
# If index.js was different than expected, upload the expected version as an artifact
46-
- uses: actions/upload-artifact@v3
42+
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected]
4743
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
4844
with:
4945
name: dist

.github/workflows/test.yml

+11-12
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,23 @@ on:
66
- main
77
- 'releases/*'
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest
1215
steps:
1316
- uses: actions/checkout@v3
1417

15-
# check the node version from the .node-version file
16-
- name: fetch node version
17-
id: node-version
18-
run: |
19-
version=$(cat .node-version)
20-
echo "version=${version}" >> $GITHUB_OUTPUT
21-
2218
- name: setup node
23-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
2420
with:
25-
node-version: ${{ steps.node-version.outputs.version }}
26-
cache: npm
21+
node-version-file: .node-version
22+
cache: 'npm'
23+
24+
- name: install dependencies
25+
run: npm ci
2726

28-
- run: npm ci
29-
- run: npm run ci-test
27+
- name: test
28+
run: npm run ci-test

script/release

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GREEN='\033[0;32m'
1010
BLUE='\033[0;34m'
1111

1212
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
13-
echo -e "The latest release tag is:${BLUE}${latest_tag}${OFF}"
13+
echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
1414
read -p 'New Release Tag (vX.X.X format): ' new_tag
1515

1616
tag_regex='^v\d\.\d\.\d$'
@@ -26,5 +26,5 @@ echo -e "${GREEN}OK${OFF} - Tagged: $new_tag"
2626

2727
git push --tags
2828

29-
echo -e "${GREEN}OK${OFF} - Tags pushed to remote! This will trigger a GitHub action release"
29+
echo -e "${GREEN}OK${OFF} - Tags pushed to remote!"
3030
echo -e "${GREEN}DONE${OFF}"

0 commit comments

Comments
 (0)